/*
 * $Id: port.h,v 1.251.2.18 Broadcom SDK $
 * 
 * $Copyright: Copyright 2011 Broadcom Corporation.
 * This program is the proprietary software of Broadcom Corporation
 * and/or its licensors, and may only be used, duplicated, modified
 * or distributed pursuant to the terms and conditions of a separate,
 * written license agreement executed between you and Broadcom
 * (an "Authorized License").  Except as set forth in an Authorized
 * License, Broadcom grants no license (express or implied), right
 * to use, or waiver of any kind with respect to the Software, and
 * Broadcom expressly reserves all rights in and to the Software
 * and all intellectual property rights therein.  IF YOU HAVE
 * NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE
 * IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
 * ALL USE OF THE SOFTWARE.  
 *  
 * Except as expressly set forth in the Authorized License,
 *  
 * 1.     This program, including its structure, sequence and organization,
 * constitutes the valuable trade secrets of Broadcom, and you shall use
 * all reasonable efforts to protect the confidentiality thereof,
 * and to use this information only in connection with your use of
 * Broadcom integrated circuit products.
 *  
 * 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS
 * PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
 * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
 * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY
 * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
 * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
 * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
 * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
 * OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
 * 
 * 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
 * BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL,
 * INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER
 * ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY
 * TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF
 * THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00,
 * WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING
 * ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.$
 * 
 * DO NOT EDIT THIS FILE!
 * This file is auto-generated.
 * Edits to this file will be lost when it is regenerated.
 */

#ifndef __BCM_PORT_H__
#define __BCM_PORT_H__

#include <shared/portmode.h>
#include <shared/port.h>
#include <shared/phyconfig.h>
#include <shared/phyreg.h>
#include <bcm/types.h>
#include <bcm/stat.h>
#include <shared/port_ability.h>
#include <bcm/ces.h>

/* Port Configuration structure. */
typedef struct bcm_port_config_s {
    bcm_pbmp_t fe;          /* Mask of FE ports. */
    bcm_pbmp_t ge;          /* Mask of GE ports. */
    bcm_pbmp_t xe;          /* Mask of 10gig ports. */
    bcm_pbmp_t e;           /* Mask of eth ports. */
    bcm_pbmp_t hg;          /* Mask of Higig ports. */
    bcm_pbmp_t sci;         /* Mask of SCI ports. */
    bcm_pbmp_t sfi;         /* Mask of SFI ports. */
    bcm_pbmp_t spi;         /* Mask of SPI ports. */
    bcm_pbmp_t spi_subport; /* Mask of SPI subports. */
    bcm_pbmp_t port;        /* Mask of all front panel ports. */
    bcm_pbmp_t cpu;         /* Mask of CPU ports. */
    bcm_pbmp_t all;         /* Mask of all ports. */
    bcm_pbmp_t stack_int;   /* Deprecated - unused. */
    bcm_pbmp_t stack_ext;   /* Mask of Stack ports. */
    bcm_pbmp_t tdm;         /* Mask of TDM ports. */
    bcm_pbmp_t pon;         /* Mask of PON ports. */
    bcm_pbmp_t llid;        /* Mask of LLID ports. */
} bcm_port_config_t;

/* Port ability */
typedef _shr_port_ability_t bcm_port_ability_t;

#define BCM_PORT_ABILITY_10MB               _SHR_PA_SPEED_10MB 
#define BCM_PORT_ABILITY_20MB               _SHR_PA_SPEED_20MB 
#define BCM_PORT_ABILITY_25MB               _SHR_PA_SPEED_25MB 
#define BCM_PORT_ABILITY_33MB               _SHR_PA_SPEED_33MB 
#define BCM_PORT_ABILITY_50MB               _SHR_PA_SPEED_50MB 
#define BCM_PORT_ABILITY_100MB              _SHR_PA_SPEED_100MB 
#define BCM_PORT_ABILITY_1000MB             _SHR_PA_SPEED_1000MB 
#define BCM_PORT_ABILITY_2500MB             _SHR_PA_SPEED_2500MB 
#define BCM_PORT_ABILITY_3000MB             _SHR_PA_SPEED_3000MB 
#define BCM_PORT_ABILITY_5000MB             _SHR_PA_SPEED_5000MB 
#define BCM_PORT_ABILITY_6000MB             _SHR_PA_SPEED_6000MB 
#define BCM_PORT_ABILITY_10GB               _SHR_PA_SPEED_10GB 
#define BCM_PORT_ABILITY_12GB               _SHR_PA_SPEED_12GB 
#define BCM_PORT_ABILITY_12P5GB             _SHR_PA_SPEED_12P5GB 
#define BCM_PORT_ABILITY_13GB               _SHR_PA_SPEED_13GB 
#define BCM_PORT_ABILITY_15GB               _SHR_PA_SPEED_15GB 
#define BCM_PORT_ABILITY_16GB               _SHR_PA_SPEED_16GB 
#define BCM_PORT_ABILITY_20GB               _SHR_PA_SPEED_20GB 
#define BCM_PORT_ABILITY_21GB               _SHR_PA_SPEED_21GB 
#define BCM_PORT_ABILITY_24GB               _SHR_PA_SPEED_24GB 
#define BCM_PORT_ABILITY_25GB               _SHR_PA_SPEED_25GB 
#define BCM_PORT_ABILITY_30GB               _SHR_PA_SPEED_30GB 
#define BCM_PORT_ABILITY_40GB               _SHR_PA_SPEED_40GB 
#define BCM_PORT_ABILITY_42GB               _SHR_PA_SPEED_42GB 
#define BCM_PORT_ABILITY_INTERFACE_TBI      _SHR_PA_INTF_TBI 
#define BCM_PORT_ABILITY_INTERFACE_MII      _SHR_PA_INTF_MII 
#define BCM_PORT_ABILITY_INTERFACE_GMII     _SHR_PA_INTF_GMII 
#define BCM_PORT_ABILITY_INTERFACE_SGMII    _SHR_PA_INTF_SGMII 
#define BCM_PORT_ABILITY_INTERFACE_XGMII    _SHR_PA_INTF_XGMII 
#define BCM_PORT_ABILITY_INTERFACE_QSGMII   _SHR_PA_INTF_QSGMII 
#define BCM_PORT_ABILITY_MEDIUM_COPPER      _SHR_PA_MEDIUM_COPPER 
#define BCM_PORT_ABILITY_MEDIUM_FIBER       _SHR_PA_MEDIUM_FIBER 
#define BCM_PORT_ABILITY_LB_NONE            _SHR_PA_LB_NONE 
#define BCM_PORT_ABILITY_LB_MAC             _SHR_PA_LB_MAC 
#define BCM_PORT_ABILITY_LB_PHY             _SHR_PA_LB_PHY 
#define BCM_PORT_ABILITY_LB_LINE            _SHR_PA_LB_LINE 
#define BCM_PORT_ABILITY_AUTONEG            _SHR_PA_AUTONEG 
#define BCM_PORT_ABILITY_COMBO              _SHR_PA_COMBO 
#define BCM_PORT_ABILITY_PAUSE_TX           _SHR_PA_PAUSE_TX 
#define BCM_PORT_ABILITY_PAUSE_RX           _SHR_PA_PAUSE_RX 
#define BCM_PORT_ABILITY_PAUSE              _SHR_PA_PAUSE /* Both TX and RX. */
#define BCM_PORT_ABILITY_PAUSE_ASYMM        _SHR_PA_PAUSE_ASYMM /* The following is used
                                                          only by
                                                          bcm_port_ability_get,
                                                          and indicates that a
                                                          port can support
                                                          having PAUSE_TX be
                                                          different than
                                                          PAUSE_RX. */
#define BCM_PORT_ABILITY_EEE_100MB_BASETX   _SHR_PA_EEE_100MB_BASETX /* EEE ability at
                                                          100M-BaseTX. */
#define BCM_PORT_ABILITY_EEE_1GB_BASET      _SHR_PA_EEE_1GB_BASET /* EEE ability at
                                                          1G-BaseT. */
#define BCM_PORT_ABILITY_EEE_10GB_BASET     _SHR_PA_EEE_10GB_BASET /* EEE ability at
                                                          10G-BaseT. */
#define BCM_PORT_ABILITY_EEE_10GB_KX        _SHR_PA_EEE_10GB_KX /* EEE ability at
                                                          10GB-KX. */
#define BCM_PORT_ABILITY_EEE_10GB_KX4       _SHR_PA_EEE_10GB_KX4 /* EEE ability at
                                                          10GB-KX4. */
#define BCM_PORT_ABILITY_EEE_10GB_KR        _SHR_PA_EEE_10GB_KR /* EEE ability at
                                                          10GB-KR. */
#define BCM_PORT_ABILITY_FCMAP              _SHR_PA_FCMAP /* Fiber Channel ability. */
#define BCM_PORT_ABILITY_FCMAP_FCMAC_LOOPBACK _SHR_PA_FCMAP_FCMAC_LOOPBACK /* Fiber Channel FCMAC
                                                          loopback ability. */
#define BCM_PORT_ABILITY_FCMAP_AUTONEG      _SHR_PA_FCMAP_AUTONEG /* Fiber Channel FCMAC
                                                          autoneg ability. */
#define BCM_PORT_ABILITY_FCMAP_2GB          _SHR_PA_FCMAP_2GB /* Fiber Channel ability
                                                          at 2GB. */
#define BCM_PORT_ABILITY_FCMAP_4GB          _SHR_PA_FCMAP_4GB /* Fiber Channel ability
                                                          at 4GB. */
#define BCM_PORT_ABILITY_FCMAP_8GB          _SHR_PA_FCMAP_8GB /* Fiber Channel ability
                                                          at 8GB. */
#define BCM_PORT_ABILITY_FCMAP_16GB         _SHR_PA_FCMAP_16GB /* Fiber Channel ability
                                                          at 16GB. */

/* 
 * Port ability mask.
 * 
 * The following flags are used to indicate which set of capabilities are
 * provided by a PHY or MAC when retrieving the ability of a port,
 * setting or getting the local advertisement, getting the remote
 * advertisement, or setting the MAC encapsulation and/or CRC modes.
 */
typedef _shr_port_mode_t bcm_port_abil_t;

#define BCM_PORT_ABIL_10MB_HD       _SHR_PM_10MB_HD 
#define BCM_PORT_ABIL_10MB_FD       _SHR_PM_10MB_FD 
#define BCM_PORT_ABIL_100MB_HD      _SHR_PM_100MB_HD 
#define BCM_PORT_ABIL_100MB_FD      _SHR_PM_100MB_FD 
#define BCM_PORT_ABIL_1000MB_HD     _SHR_PM_1000MB_HD 
#define BCM_PORT_ABIL_1000MB_FD     _SHR_PM_1000MB_FD 
#define BCM_PORT_ABIL_2500MB_HD     _SHR_PM_2500MB_HD 
#define BCM_PORT_ABIL_2500MB_FD     _SHR_PM_2500MB_FD 
#define BCM_PORT_ABIL_3000MB_HD     _SHR_PM_3000MB_HD 
#define BCM_PORT_ABIL_3000MB_FD     _SHR_PM_3000MB_FD 
#define BCM_PORT_ABIL_10GB_HD       _SHR_PM_10GB_HD 
#define BCM_PORT_ABIL_10GB_FD       _SHR_PM_10GB_FD 
#define BCM_PORT_ABIL_12GB_HD       _SHR_PM_12GB_HD 
#define BCM_PORT_ABIL_12GB_FD       _SHR_PM_12GB_FD 
#define BCM_PORT_ABIL_13GB_HD       _SHR_PM_13GB_HD 
#define BCM_PORT_ABIL_13GB_FD       _SHR_PM_13GB_FD 
#define BCM_PORT_ABIL_16GB_HD       _SHR_PM_16GB_HD 
#define BCM_PORT_ABIL_16GB_FD       _SHR_PM_16GB_FD 
#define BCM_PORT_ABIL_TBI           _SHR_PM_TBI 
#define BCM_PORT_ABIL_MII           _SHR_PM_MII 
#define BCM_PORT_ABIL_GMII          _SHR_PM_GMII 
#define BCM_PORT_ABIL_SGMII         _SHR_PM_SGMII 
#define BCM_PORT_ABIL_XGMII         _SHR_PM_XGMII 
#define BCM_PORT_ABIL_LB_MAC        _SHR_PM_LB_MAC 
#define BCM_PORT_ABIL_LB_PHY        _SHR_PM_LB_PHY 
#define BCM_PORT_ABIL_LB_NONE       _SHR_PM_LB_NONE 
#define BCM_PORT_ABIL_AN            _SHR_PM_AN 
#define BCM_PORT_ABIL_COMBO         _SHR_PM_COMBO 
#define BCM_PORT_ABIL_PAUSE_TX      _SHR_PM_PAUSE_TX 
#define BCM_PORT_ABIL_PAUSE_RX      _SHR_PM_PAUSE_RX 
#define BCM_PORT_ABIL_PAUSE         _SHR_PM_PAUSE /* Both TX and RX. */
#define BCM_PORT_ABIL_10B           BCM_PORT_ABIL_TBI /* Deprecated */
#define BCM_PORT_ABIL_PAUSE_ASYMM   _SHR_PM_PAUSE_ASYMM /* The following is used only by
                                                  bcm_port_ability_get, and
                                                  indicates that a port can
                                                  support having PAUSE_TX be
                                                  different than PAUSE_RX. */
#define BCM_PORT_ABIL_10MB          _SHR_PM_10MB 
#define BCM_PORT_ABIL_100MB         _SHR_PM_100MB 
#define BCM_PORT_ABIL_1000MB        _SHR_PM_1000MB 
#define BCM_PORT_ABIL_2500MB        _SHR_PM_2500MB 
#define BCM_PORT_ABIL_3000MB        _SHR_PM_3000MB 
#define BCM_PORT_ABIL_10GB          _SHR_PM_10GB 
#define BCM_PORT_ABIL_12GB          _SHR_PM_12GB 
#define BCM_PORT_ABIL_13GB          _SHR_PM_13GB 
#define BCM_PORT_ABIL_16GB          _SHR_PM_16GB 
#define BCM_PORT_ABIL_HD            _SHR_PM_HD 
#define BCM_PORT_ABIL_FD            _SHR_PM_FD 
#define BCM_PORT_ABIL_SPD_ANY       _SHR_PM_SPEED_ALL 

#define BCM_PORT_ABIL_SPD_MAX(abil)  \
    _SHR_PM_SPEED_MAX(abil) 

#define BCM_PORT_ABILITY_SPEED_MAX(abil)  _SHR_PA_SPEED_MAX(abil) 

#define BCM_PORT_CONTROL_FABRIC_HEADER_83200 _SHR_PORT_CONTROL_FABRIC_HEADER_83200 
#define BCM_PORT_CONTROL_FABRIC_HEADER_88230 _SHR_PORT_CONTROL_FABRIC_HEADER_88230 
#define BCM_PORT_CONTROL_FABRIC_HEADER_88020_83200_88230_INTEROP _SHR_PORT_CONTROL_FABRIC_HEADER_88020_83200_88230_INTEROP 
#define BCM_PORT_CONTROL_FABRIC_HEADER_CUSTOM _SHR_PORT_CONTROL_FABRIC_HEADER_CUSTOM 

#ifndef BCM_HIDE_DISPATCHABLE

/* Initialize the port subsystem. */
extern int bcm_port_init(
    int unit);

/* 
 * Initialize the port subsystem without affecting the current state of
 * stack ports.
 */
extern int bcm_port_clear(
    int unit);

/* Probe the port to determine the proper MAC and PHY drivers. */
extern int bcm_port_probe(
    int unit, 
    bcm_pbmp_t pbmp, 
    bcm_pbmp_t *okay_pbmp);

/* Detach ports from the BCM API. */
extern int bcm_port_detach(
    int unit, 
    bcm_pbmp_t pbmp, 
    bcm_pbmp_t *detached);

/* 
 * Retrieved the port configuration for the specified device or for all
 * ports known to bcmx.
 */
extern int bcm_port_config_get(
    int unit, 
    bcm_port_config_t *config);

/* Enable or disable a port. */
extern int bcm_port_enable_set(
    int unit, 
    bcm_port_t port, 
    int enable);

/* Enable or disable a port. */
extern int bcm_port_enable_get(
    int unit, 
    bcm_port_t port, 
    int *enable);

/* Set or retrieve autonegotiation settings for a port. */
extern int bcm_port_advert_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_abil_t ability_mask);

/* Set or retrieve autonegotiation settings for a port. */
extern int bcm_port_ability_advert_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_ability_t *ability_mask);

/* Set or retrieve autonegotiation settings for a port. */
extern int bcm_port_advert_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_abil_t *ability_mask);

/* Set or retrieve autonegotiation settings for a port. */
extern int bcm_port_ability_advert_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_ability_t *ability_mask);

/* Set or retrieve autonegotiation settings for a port. */
extern int bcm_port_advert_remote_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_abil_t *ability_mask);

/* Set or retrieve autonegotiation settings for a port. */
extern int bcm_port_ability_remote_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_ability_t *ability_mask);

/* 
 * Retrieve the valid operating modes of a port including speed and
 * duplex.
 */
extern int bcm_port_ability_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_abil_t *local_ability_mask);

/* 
 * Retrieve the valid operating modes of a port including speed and
 * duplex.
 */
extern int bcm_port_ability_local_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_ability_t *local_ability_mask);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Backward compatibility. */
#define bcm_port_remote_advert_get  bcm_port_advert_remote_get 

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set the default vlan for packets that ingress untagged. */
extern int bcm_port_untagged_vlan_set(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vid);

/* Get or set the default vlan for packets that ingress untagged. */
extern int bcm_port_untagged_vlan_get(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t *vid_ptr);

/* Get or set the default priority for packets that ingress untagged. */
extern int bcm_port_untagged_priority_set(
    int unit, 
    bcm_port_t port, 
    int priority);

/* Get or set the default priority for packets that ingress untagged. */
extern int bcm_port_untagged_priority_get(
    int unit, 
    bcm_port_t port, 
    int *priority);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_DSCP_MAP_NONE  0          /* Disable DSCP mapping */
#define BCM_PORT_DSCP_MAP_ZERO  1          /* Map only if incoming DSCP = 0. */
#define BCM_PORT_DSCP_MAP_ALL   2          /* Map all. */

#ifndef BCM_HIDE_DISPATCHABLE

/* Control mapping of Differentiated Services Code Points (DSCP). */
extern int bcm_port_dscp_map_mode_set(
    int unit, 
    bcm_port_t port, 
    int mode);

/* Control mapping of Differentiated Services Code Points (DSCP). */
extern int bcm_port_dscp_map_mode_get(
    int unit, 
    bcm_port_t port, 
    int *mode);

/* Control mapping of Differentiated Services Code Points (DSCP). */
extern int bcm_port_dscp_map_set(
    int unit, 
    bcm_port_t port, 
    int srccp, 
    int mapcp, 
    int prio);

/* Control mapping of Differentiated Services Code Points (DSCP). */
extern int bcm_port_dscp_map_get(
    int unit, 
    bcm_port_t port, 
    int srccp, 
    int *mapcp, 
    int *prio);

/* Get or set the current linkscan mode for the specified port. */
extern int bcm_port_linkscan_set(
    int unit, 
    bcm_port_t port, 
    int linkscan);

/* Get or set the current linkscan mode for the specified port. */
extern int bcm_port_linkscan_get(
    int unit, 
    bcm_port_t port, 
    int *linkscan);

/* 
 * Configure or retrieve the current autonegotiation settings for a port,
 * or restart autonegotiation if already enabled.
 */
extern int bcm_port_autoneg_set(
    int unit, 
    bcm_port_t port, 
    int autoneg);

/* 
 * Configure or retrieve the current autonegotiation settings for a port,
 * or restart autonegotiation if already enabled.
 */
extern int bcm_port_autoneg_get(
    int unit, 
    bcm_port_t port, 
    int *autoneg);

/* Get or set the current operating speed of a port. */
extern int bcm_port_speed_max(
    int unit, 
    bcm_port_t port, 
    int *speed);

/* Get or set the current operating speed of a port. */
extern int bcm_port_speed_set(
    int unit, 
    bcm_port_t port, 
    int speed);

/* Get or set the current operating speed of a port. */
extern int bcm_port_speed_get(
    int unit, 
    bcm_port_t port, 
    int *speed);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_ms_t */
typedef _shr_port_ms_t bcm_port_ms_t;

#define BCM_PORT_MS_SLAVE       _SHR_PORT_MS_SLAVE 
#define BCM_PORT_MS_MASTER      _SHR_PORT_MS_MASTER 
#define BCM_PORT_MS_AUTO        _SHR_PORT_MS_AUTO 
#define BCM_PORT_MS_NONE        _SHR_PORT_MS_NONE 
#define BCM_PORT_MS_COUNT       _SHR_PORT_MS_COUNT 

#ifndef BCM_HIDE_DISPATCHABLE

/* Set or get the Master mode on the PHY attached to the specified port. */
extern int bcm_port_master_set(
    int unit, 
    bcm_port_t port, 
    int ms);

/* Set or get the Master mode on the PHY attached to the specified port. */
extern int bcm_port_master_get(
    int unit, 
    bcm_port_t port, 
    int *ms);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_if_t */
typedef _shr_port_if_t bcm_port_if_t;

#define BCM_PORT_IF_NOCXN       _SHR_PORT_IF_NOCXN 
#define BCM_PORT_IF_NULL        _SHR_PORT_IF_NULL 
#define BCM_PORT_IF_MII         _SHR_PORT_IF_MII 
#define BCM_PORT_IF_GMII        _SHR_PORT_IF_GMII 
#define BCM_PORT_IF_SGMII       _SHR_PORT_IF_SGMII 
#define BCM_PORT_IF_TBI         _SHR_PORT_IF_TBI 
#define BCM_PORT_IF_XGMII       _SHR_PORT_IF_XGMII 
#define BCM_PORT_IF_RGMII       _SHR_PORT_IF_RGMII 
#define BCM_PORT_IF_SFI         _SHR_PORT_IF_SFI 
#define BCM_PORT_IF_XFI         _SHR_PORT_IF_XFI 
#define BCM_PORT_IF_KR          _SHR_PORT_IF_KR 
#define BCM_PORT_IF_KR4         _SHR_PORT_IF_KR4 
#define BCM_PORT_IF_CR          _SHR_PORT_IF_CR 
#define BCM_PORT_IF_CR4         _SHR_PORT_IF_CR4 
#define BCM_PORT_IF_XLAUI       _SHR_PORT_IF_XLAUI 
#define BCM_PORT_IF_SR          _SHR_PORT_IF_SR 
#define BCM_PORT_IF_COUNT       _SHR_PORT_IF_COUNT 

#define BCM_PORT_IF_10B         BCM_PORT_IF_TBI /* Deprecated */

#ifndef BCM_HIDE_DISPATCHABLE

/* 
 * Configure the physical interface between the MAC and the PHY for the
 * specified port.
 */
extern int bcm_port_interface_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_if_t intf);

/* 
 * Configure the physical interface between the MAC and the PHY for the
 * specified port.
 */
extern int bcm_port_interface_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_if_t *intf);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_duplex_t */
typedef _shr_port_duplex_t bcm_port_duplex_t;

#define BCM_PORT_DUPLEX_HALF    _SHR_PORT_DUPLEX_HALF 
#define BCM_PORT_DUPLEX_FULL    _SHR_PORT_DUPLEX_FULL 
#define BCM_PORT_DUPLEX_COUNT   _SHR_PORT_DUPLEX_COUNT 

/* Port pause modes (mainly used by the BCMX layer). */
typedef enum bcm_port_pause_e {
    BCM_PORT_PAUSE_NONE, 
    BCM_PORT_PAUSE_ASYM_RX, 
    BCM_PORT_PAUSE_ASYM_TX, 
    BCM_PORT_PAUSE_SYM 
} bcm_port_pause_t;

/* Set NIV Port type. */
typedef enum bcm_port_niv_type_e {
    BCM_PORT_NIV_TYPE_UPLINK_ACCESS, 
    BCM_PORT_NIV_TYPE_UPLINK_TRANSIT, 
    BCM_PORT_NIV_TYPE_DOWNLINK_ACCESS, 
    BCM_PORT_NIV_TYPE_DOWNLINK_TRANSIT, 
    BCM_PORT_NIV_TYPE_SWITCH 
} bcm_port_niv_type_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set the current duplex mode of a port. */
extern int bcm_port_duplex_set(
    int unit, 
    bcm_port_t port, 
    int duplex);

/* Get or set the current duplex mode of a port. */
extern int bcm_port_duplex_get(
    int unit, 
    bcm_port_t port, 
    int *duplex);

/* 
 * Enable or disable transmission of pause frames and honoring received
 * pause frames on a port.
 */
extern int bcm_port_pause_set(
    int unit, 
    bcm_port_t port, 
    int pause_tx, 
    int pause_rx);

/* 
 * Enable or disable transmission of pause frames and honoring received
 * pause frames on a port.
 */
extern int bcm_port_pause_get(
    int unit, 
    bcm_port_t port, 
    int *pause_tx, 
    int *pause_rx);

/* 
 * Get or set the source MAC address transmitted in MAC control pause
 * frames.
 */
extern int bcm_port_pause_addr_set(
    int unit, 
    bcm_port_t port, 
    bcm_mac_t mac);

/* 
 * Get or set the source MAC address transmitted in MAC control pause
 * frames.
 */
extern int bcm_port_pause_addr_get(
    int unit, 
    bcm_port_t port, 
    bcm_mac_t mac);

/* Configure or retrieve asymmetric pause setting for a port. */
extern int bcm_port_pause_sym_set(
    int unit, 
    bcm_port_t port, 
    int pause);

/* Configure or retrieve asymmetric pause setting for a port. */
extern int bcm_port_pause_sym_get(
    int unit, 
    bcm_port_t port, 
    int *pause);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Backward compatibility. */
#define bcm_port_sym_pause_set  bcm_port_pause_sym_set 
#define bcm_port_sym_pause_get  bcm_port_pause_sym_get 

#ifndef BCM_HIDE_DISPATCHABLE

/* Process a link change event and perform required device configuration. */
extern int bcm_port_update(
    int unit, 
    bcm_port_t port, 
    int link);

/* Set or retrieve the current maximum packet size permitted on a port. */
extern int bcm_port_frame_max_set(
    int unit, 
    bcm_port_t port, 
    int size);

/* Set or retrieve the current maximum packet size permitted on a port. */
extern int bcm_port_frame_max_get(
    int unit, 
    bcm_port_t port, 
    int *size);

/* 
 * Set or retrieve the current maximum L3 packet size permitted on a
 * port.
 */
extern int bcm_port_l3_mtu_set(
    int unit, 
    bcm_port_t port, 
    int size);

/* 
 * Set or retrieve the current maximum L3 packet size permitted on a
 * port.
 */
extern int bcm_port_l3_mtu_get(
    int unit, 
    bcm_port_t port, 
    int *size);

/* Get or set half duplex flow control (jam) for a port. */
extern int bcm_port_jam_set(
    int unit, 
    bcm_port_t port, 
    int enable);

/* Get or set half duplex flow control (jam) for a port. */
extern int bcm_port_jam_get(
    int unit, 
    bcm_port_t port, 
    int *enable);

/* Get or set the interframe gap settings for the specified port. */
extern int bcm_port_ifg_set(
    int unit, 
    bcm_port_t port, 
    int speed, 
    bcm_port_duplex_t duplex, 
    int bit_times);

/* Get or set the interframe gap settings for the specified port. */
extern int bcm_port_ifg_get(
    int unit, 
    bcm_port_t port, 
    int speed, 
    bcm_port_duplex_t duplex, 
    int *bit_times);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Values for flags parameter of bcm_port_force_vlan_set/get. */
#define BCM_PORT_FORCE_VLAN_ENABLE  0x01       /* Enable force VLAN on this
                                                  port. */
#define BCM_PORT_FORCE_VLAN_UNTAG   0x02       /* Egress untagged when force
                                                  VLAN is enabled on this port. */

#ifndef BCM_HIDE_DISPATCHABLE

/* Set/Get force vlan attribute of a port. */
extern int bcm_port_force_vlan_set(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vlan, 
    int pkt_prio, 
    uint32 flags);

/* Set/Get force vlan attribute of a port. */
extern int bcm_port_force_vlan_get(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t *vlan, 
    int *pkt_prio, 
    uint32 *flags);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Flags for direct PHY register access. */
#define BCM_PORT_PHY_INTERNAL   _SHR_PORT_PHY_INTERNAL 
#define BCM_PORT_PHY_NOMAP      _SHR_PORT_PHY_NOMAP 
#define BCM_PORT_PHY_CLAUSE45   _SHR_PORT_PHY_CLAUSE45 
#define BCM_PORT_PHY_I2C_DATA8  _SHR_PORT_PHY_I2C_DATA8 
#define BCM_PORT_PHY_I2C_DATA16 _SHR_PORT_PHY_I2C_DATA16 

#define BCM_PORT_PHY_CLAUSE45_ADDR(_devad, _regad)  \
    _SHR_PORT_PHY_CLAUSE45_ADDR(_devad, _regad) 

#define BCM_PORT_PHY_CLAUSE45_DEVAD(_reg_addr)  \
    _SHR_PORT_PHY_CLAUSE45_DEVAD(_reg_addr) 

#define BCM_PORT_PHY_CLAUSE45_REGAD(_reg_addr)  \
    _SHR_PORT_PHY_CLAUSE45_REGAD(_reg_addr) 

#define BCM_PORT_PHY_I2C_ADDR(_devad, _regad)  \
    _SHR_PORT_PHY_I2C_ADDR(_devad, _regad) 

#define BCM_PORT_PHY_I2C_DEVAD(_reg_addr)  \
    _SHR_PORT_PHY_I2C_DEVAD(_reg_addr) 

#define BCM_PORT_PHY_I2C_REGAD(_reg_addr)  \
    _SHR_PORT_PHY_I2C_REGAD(_reg_addr) 

/* Flags for indirect PHY register access. */
#define BCM_PORT_PHY_REG_1000X  _SHR_PORT_PHY_REG_1000X 

#define BCM_PORT_PHY_REG_INDIRECT_ADDR(_flags, _reg_type, _reg_selector)  \
    _SHR_PORT_PHY_REG_INDIRECT_ADDR(_flags, _reg_type, _reg_selector) 

#define BCM_PORT_PHY_REG_FLAGS(_reg_addr)  _SHR_PORT_PHY_REG_FLAGS(_reg_addr) 

#define BCM_PORT_PHY_REG_BANK(_reg_addr)  _SHR_PORT_PHY_REG_BANK(_reg_addr) 

#define BCM_PORT_PHY_REG_ADDR(_reg_addr)  _SHR_PORT_PHY_REG_ADDR(_reg_addr) 

#ifndef BCM_HIDE_DISPATCHABLE

/* Write phy registers associated with a port. */
extern int bcm_port_phy_set(
    int unit, 
    bcm_port_t port, 
    uint32 flags, 
    uint32 phy_reg_addr, 
    uint32 phy_data);

/* Read phy registers associated with a port. */
extern int bcm_port_phy_get(
    int unit, 
    bcm_port_t port, 
    uint32 flags, 
    uint32 phy_reg_addr, 
    uint32 *phy_data);

/* Modify phy registers associated with a port. */
extern int bcm_port_phy_modify(
    int unit, 
    bcm_port_t port, 
    uint32 flags, 
    uint32 phy_reg_addr, 
    uint32 phy_data, 
    uint32 phy_mask);

#endif /* BCM_HIDE_DISPATCHABLE */

/* PHY reset callback function prototype. */
typedef _shr_port_phy_reset_cb_t bcm_port_phy_reset_cb_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Register or unregister a callout to post process PHY resets. */
extern int bcm_port_phy_reset_register(
    int unit, 
    bcm_port_t port, 
    bcm_port_phy_reset_cb_t callback, 
    void *user_data);

/* Register or unregister a callout to post process PHY resets. */
extern int bcm_port_phy_reset_unregister(
    int unit, 
    bcm_port_t port, 
    bcm_port_phy_reset_cb_t callback, 
    void *user_data);

/* Perform low level PHY reset. */
extern int bcm_port_phy_reset(
    int unit, 
    bcm_port_t port);

#endif /* BCM_HIDE_DISPATCHABLE */

/* MDI crossover control. */
typedef _shr_port_mdix_t bcm_port_mdix_t;

/* MDI crossover control values. */
#define BCM_PORT_MDIX_AUTO          _SHR_PORT_MDIX_AUTO 
#define BCM_PORT_MDIX_FORCE_AUTO    _SHR_PORT_MDIX_FORCE_AUTO 
#define BCM_PORT_MDIX_NORMAL        _SHR_PORT_MDIX_NORMAL 
#define BCM_PORT_MDIX_XOVER         _SHR_PORT_MDIX_XOVER 
#define BCM_PORT_MDIX_COUNT         _SHR_PORT_MDIX_COUNT 

/* MDI crossover status. */
typedef _shr_port_mdix_status_t bcm_port_mdix_status_t;

/* MDI crossover status values. */
#define BCM_PORT_MDIX_STATUS_NORMAL _SHR_PORT_MDIX_STATUS_NORMAL 
#define BCM_PORT_MDIX_STATUS_XOVER  _SHR_PORT_MDIX_STATUS_XOVER 
#define BCM_PORT_MDIX_STATUS_COUNT  _SHR_PORT_MDIX_STATUS_COUNT 

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set the Auto MDIX mode for a port. */
extern int bcm_port_mdix_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_mdix_t mode);

/* Get or set the Auto MDIX mode for a port. */
extern int bcm_port_mdix_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_mdix_t *mode);

/* Get or set the Auto MDIX mode for a port. */
extern int bcm_port_mdix_status_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_mdix_status_t *status);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Combo port control/status. */
typedef _shr_port_medium_t bcm_port_medium_t;

/* Combo port control/status values. */
#define BCM_PORT_MEDIUM_NONE    _SHR_PORT_MEDIUM_NONE 
#define BCM_PORT_MEDIUM_COPPER  _SHR_PORT_MEDIUM_COPPER 
#define BCM_PORT_MEDIUM_FIBER   _SHR_PORT_MEDIUM_FIBER 
#define BCM_PORT_MEDIUM_COUNT   _SHR_PORT_MEDIUM_COUNT 

/* Call back function prototype for media status changes. */
typedef _shr_port_medium_status_cb_t bcm_port_medium_status_cb_t;

/* bcm_phy_config_t */
typedef _shr_phy_config_t bcm_phy_config_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set medium preferences for combination ports. */
extern int bcm_port_medium_config_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_medium_t medium, 
    bcm_phy_config_t *config);

/* Get or set medium preferences for combination ports. */
extern int bcm_port_medium_config_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_medium_t medium, 
    bcm_phy_config_t *config);

/* Get or set medium preferences for combination ports. */
extern int bcm_port_medium_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_medium_t *medium);

/* Register or unregister a call back function on media status changes. */
extern int bcm_port_medium_status_register(
    int unit, 
    bcm_port_t port, 
    bcm_port_medium_status_cb_t callback, 
    void *user_data);

/* Register or unregister a call back function on media status changes. */
extern int bcm_port_medium_status_unregister(
    int unit, 
    bcm_port_t port, 
    bcm_port_medium_status_cb_t callback, 
    void *user_data);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Port loopback modes. */
typedef enum bcm_port_loopback_e {
    BCM_PORT_LOOPBACK_NONE, 
    BCM_PORT_LOOPBACK_MAC, 
    BCM_PORT_LOOPBACK_PHY, 
    BCM_PORT_LOOPBACK_COUNT 
} bcm_port_loopback_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Set the current loopback mode of a port. */
extern int bcm_port_loopback_set(
    int unit, 
    bcm_port_t port, 
    int loopback);

/* Retrieve the current loopback mode of a port. */
extern int bcm_port_loopback_get(
    int unit, 
    bcm_port_t port, 
    int *loopback);

/* 
 * Set the spanning tree state for a port (single instance spanning tree
 * only).
 */
extern int bcm_port_stp_set(
    int unit, 
    bcm_port_t port, 
    int state);

/* 
 * Get the spanning tree state for a port (single instance spanning tree
 * only).
 */
extern int bcm_port_stp_get(
    int unit, 
    bcm_port_t port, 
    int *state);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_discard_e */
typedef enum bcm_port_discard_e {
    BCM_PORT_DISCARD_NONE, 
    BCM_PORT_DISCARD_ALL, 
    BCM_PORT_DISCARD_UNTAG, 
    BCM_PORT_DISCARD_TAG, 
    BCM_PORT_DISCARD_COUNT 
} bcm_port_discard_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* 
 * Configure port discard mode for packets ingressing tagged and
 * untagged.
 */
extern int bcm_port_discard_set(
    int unit, 
    bcm_port_t port, 
    int mode);

/* Get the port discard mode for packets ingressing tagged and untagged. */
extern int bcm_port_discard_get(
    int unit, 
    bcm_port_t port, 
    int *mode);

#endif /* BCM_HIDE_DISPATCHABLE */

/* 
 * Flags for learn mode
 * 
 * This call takes flags to turn on and off mutually-independent actions
 * that should be taken when a packet is received with an unknown source
 * address, or source lookup failure (SLF).
 * 
 * The set call returns BCM_E_UNAVAIL for flag combinations that are not
 * supported by the hardware.
 */
#define BCM_PORT_LEARN_ARL      0x01       /* Learn SLF address. */
#define BCM_PORT_LEARN_CPU      0x02       /* Copy SLF packet to CPU. */
#define BCM_PORT_LEARN_FWD      0x04       /* Forward SLF packet */
#define BCM_PORT_LEARN_PENDING  0x08       /* Mark learned SLF as pending */
#define BCM_PORT_LEARN_ON       0x01       /* Deprecated name */
#define BCM_PORT_LEARN_SWITCH   0x04       /* Deprecated name */

#ifndef BCM_HIDE_DISPATCHABLE

/* Control the hardware and software learning support on a port. */
extern int bcm_port_learn_set(
    int unit, 
    bcm_port_t port, 
    uint32 flags);

/* Get the hardware and software learning support on a port. */
extern int bcm_port_learn_get(
    int unit, 
    bcm_port_t port, 
    uint32 *flags);

/* Control the hardware and software learning support on a port. */
extern int bcm_port_learn_modify(
    int unit, 
    bcm_port_t port, 
    uint32 add, 
    uint32 remove);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_LINK_STATUS_DOWN           0          
#define BCM_PORT_LINK_STATUS_UP             1          
#define BCM_PORT_LINK_STATUS_FAILED         2          
#define BCM_PORT_LINK_STATUS_REMOTE_FAULT   3          

#ifndef BCM_HIDE_DISPATCHABLE

/* Retrieve the current link status of a port. */
extern int bcm_port_link_status_get(
    int unit, 
    bcm_port_t port, 
    int *status);

/* 
 * Clear failed link status from a port which has undergone LAG failover.
 *  The port is moved to down status.  The application is responsible for
 * removing the port from all trunk memberships before calling this
 * function.
 */
extern int bcm_port_link_failed_clear(
    int unit, 
    bcm_port_t port);

#endif /* BCM_HIDE_DISPATCHABLE */

/* 
 * Modes for VLAN input filtering.
 * 
 * Superceded APIs: use bcm_port_vlan_member_[get|set] instead.
 */
#define BCM_PORT_IFILTER_OFF    0          
#define BCM_PORT_IFILTER_ON     1          

#ifndef BCM_HIDE_DISPATCHABLE

/* 
 * Set current behavior of tagged packets arriving on a port not a member
 * of the specified VLAN.
 */
extern int bcm_port_ifilter_set(
    int unit, 
    bcm_port_t port, 
    int mode);

/* 
 * Retrieve current behavior of tagged packets arriving on a port not a
 * member of the specified VLAN.
 */
extern int bcm_port_ifilter_get(
    int unit, 
    bcm_port_t port, 
    int *mode);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Modes for VLAN ingress/egress filtering. */
#define BCM_PORT_VLAN_MEMBER_INGRESS    0x00000001 
#define BCM_PORT_VLAN_MEMBER_EGRESS     0x00000002 

#ifndef BCM_HIDE_DISPATCHABLE

/* 
 * Set current behavior of tagged packets arriving/leaving on a port not
 * a member of the specified VLAN.
 */
extern int bcm_port_vlan_member_set(
    int unit, 
    bcm_port_t port, 
    uint32 flags);

/* 
 * Retrieve current behavior of tagged packets arriving/leaving on a port
 * not a member of the specified VLAN.
 */
extern int bcm_port_vlan_member_get(
    int unit, 
    bcm_port_t port, 
    uint32 *flags);

/* Enable or disable BPDU processing on a port. */
extern int bcm_port_bpdu_enable_set(
    int unit, 
    bcm_port_t port, 
    int enable);

/* Enable or disable BPDU processing on a port. */
extern int bcm_port_bpdu_enable_get(
    int unit, 
    bcm_port_t port, 
    int *enable);

/* Enable or disable l3 switching on an ingress port. */
extern int bcm_port_l3_enable_set(
    int unit, 
    bcm_port_t port, 
    int enable);

/* Enable or disable l3 switching on an ingress port. */
extern int bcm_port_l3_enable_get(
    int unit, 
    bcm_port_t port, 
    int *enable);

/* bcm_port_tgid_set */
extern int bcm_port_tgid_set(
    int unit, 
    bcm_port_t port, 
    int tgid, 
    int psc);

/* bcm_port_tgid_get */
extern int bcm_port_tgid_get(
    int unit, 
    bcm_port_t port, 
    int *tgid, 
    int *psc);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_mcast_flood_t */
typedef _shr_port_mcast_flood_t bcm_port_mcast_flood_t;

#define BCM_PORT_MCAST_FLOOD_ALL        _SHR_PORT_MCAST_FLOOD_ALL 
#define BCM_PORT_MCAST_FLOOD_UNKNOWN    _SHR_PORT_MCAST_FLOOD_UNKNOWN 
#define BCM_PORT_MCAST_FLOOD_NONE       _SHR_PORT_MCAST_FLOOD_NONE 
#define BCM_PORT_MCAST_FLOOD_COUNT      _SHR_PORT_MCAST_FLOOD_COUNT 

/* Backward compatibility. */
#define BCM_PORT_PFM_MODEA      BCM_PORT_MCAST_FLOOD_ALL 
#define BCM_PORT_PFM_MODEB      BCM_PORT_MCAST_FLOOD_UNKNOWN 
#define BCM_PORT_PFM_MODEC      BCM_PORT_MCAST_FLOOD_NONE 

#ifndef BCM_HIDE_DISPATCHABLE

/* Set or retrieve the current unknown multicast behavior. */
extern int bcm_port_pfm_set(
    int unit, 
    bcm_port_t port, 
    int mode);

/* Set or retrieve the current unknown multicast behavior. */
extern int bcm_port_pfm_get(
    int unit, 
    bcm_port_t port, 
    int *mode);

#endif /* BCM_HIDE_DISPATCHABLE */

/* 
 * Port Encapsulation modes
 * 
 * Members of the XGS family of switches support multiple frame
 * (link-level) encapsulation modes (HIGIG, BCM5632, Ethernet).
 */
typedef _shr_port_encap_t bcm_port_encap_t;

#define BCM_PORT_ENCAP_IEEE             _SHR_PORT_ENCAP_IEEE 
#define BCM_PORT_ENCAP_HIGIG            _SHR_PORT_ENCAP_HIGIG 
#define BCM_PORT_ENCAP_B5632            _SHR_PORT_ENCAP_B5632 
#define BCM_PORT_ENCAP_HIGIG2           _SHR_PORT_ENCAP_HIGIG2 
#define BCM_PORT_ENCAP_HIGIG2_LITE      _SHR_PORT_ENCAP_HIGIG2_LITE 
#define BCM_PORT_ENCAP_HIGIG2_L2        _SHR_PORT_ENCAP_HIGIG2_L2 
#define BCM_PORT_ENCAP_HIGIG2_IP_GRE    _SHR_PORT_ENCAP_HIGIG2_IP_GRE 
#define BCM_PORT_ENCAP_SBX              _SHR_PORT_ENCAP_SBX 
#define BCM_PORT_ENCAP_COUNT            _SHR_PORT_ENCAP_COUNT 

/* Port Encapsulation abilities */
typedef _shr_pa_encap_t bcm_pa_encap_t;

#define BCM_PA_ENCAP_IEEE           _SHR_PA_ENCAP_IEEE 
#define BCM_PA_ENCAP_HIGIG          _SHR_PA_ENCAP_HIGIG 
#define BCM_PA_ENCAP_B5632          _SHR_PA_ENCAP_B5632 
#define BCM_PA_ENCAP_HIGIG2         _SHR_PA_ENCAP_HIGIG2 
#define BCM_PA_ENCAP_HIGIG2_L2      _SHR_PA_ENCAP_HIGIG2_L2 
#define BCM_PA_ENCAP_HIGIG2_IP_GRE  _SHR_PA_ENCAP_HIGIG2_IP_GRE 
#define BCM_PA_ENCAP_SBX            _SHR_PA_ENCAP_SBX 

/* bcm_port_encap_config_s */
typedef struct bcm_port_encap_config_s {
    bcm_port_encap_t encap; /* Port encapsulation one of the BCM_PORT_ENCAP_* */
    uint16 oui_ethertype;   /* Vendor specific ether type. */
    uint16 higig_ethertype; /* Higig ether type */
    uint8 oui[3];           /* Vendor specific value */
    bcm_mac_t dst_mac;      /* Destination MAC address */
    bcm_mac_t src_mac;      /* Source MAC address */
    uint16 tpid;            /* Outer L2 header TPID */
    uint16 vlan;            /* Outer L2 header VLAN tag */
    uint8 ttl;              /* Hop limit. */
    uint8 tos;              /* Traffic Class/Tos byte */
    bcm_ip_t src_addr;      /* Tunnel source ip address (IPv4) */
    bcm_ip_t dst_addr;      /* Tunnel destination ip address (IPv4) */
} bcm_port_encap_config_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Set the encapsulation of the given port. */
extern int bcm_port_encap_config_set(
    int unit, 
    bcm_gport_t gport, 
    bcm_port_encap_config_t *encap_config);

/* Get the encapsulation of the given port. */
extern int bcm_port_encap_config_get(
    int unit, 
    bcm_gport_t gport, 
    bcm_port_encap_config_t *encap_config);

/* Set or get the link level encapsulation mode. */
extern int bcm_port_encap_set(
    int unit, 
    bcm_port_t port, 
    int mode);

/* Set or get the link level encapsulation mode. */
extern int bcm_port_encap_get(
    int unit, 
    bcm_port_t port, 
    int *mode);

/* 
 * Get the current count of cells or packets queued on a port for
 * transmission.
 */
extern int bcm_port_queued_count_get(
    int unit, 
    bcm_port_t port, 
    uint32 *count);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_frametype_t */
typedef int bcm_port_frametype_t;

/* Protocol based VLAN support. */
#define BCM_PORT_FRAMETYPE_ETHER2       0x1        
#define BCM_PORT_FRAMETYPE_8023         0x2        
#define BCM_PORT_FRAMETYPE_SNAP         BCM_PORT_FRAMETYPE_8023 
#define BCM_PORT_FRAMETYPE_LLC          0x4        
#define BCM_PORT_FRAMETYPE_SNAP_PRIVATE 0x8        

/* bcm_port_ethertype_t */
typedef bcm_ethertype_t bcm_port_ethertype_t;

/* Backplane multiplexing type */
typedef enum bcm_port_control_ability_e {
    BCM_PORT_ABILITY_SFI = 1, 
    BCM_PORT_ABILITY_DUAL_SFI, 
    BCM_PORT_ABILITY_SCI, 
    BCM_PORT_ABILITY_SFI_SCI, 
    BCM_PORT_ABILITY_DUAL_SFI_LOCAL, 
    BCM_PORT_ABILITY_DUAL_SFI_LOOPBACK=BCM_PORT_ABILITY_DUAL_SFI_LOCAL, 
    BCM_PORT_ABILITY_SFI_LOOPBACK 
} bcm_port_control_ability_t;

/* PRBS Polynomial type */
typedef enum bcm_port_prbs_e {
    BCM_PORT_PRBS_POLYNOMIAL_X7_X6_1, 
    BCM_PORT_PRBS_POLYNOMIAL_X15_X14_1, 
    BCM_PORT_PRBS_POLYNOMIAL_X23_X18_1, 
    BCM_PORT_PRBS_POLYNOMIAL_X31_X28_1 
} bcm_port_prbs_t;

/* Backward compatibility. */
#define bcm_port_untagged_protocol_vlan_add \
    bcm_port_protocol_vlan_add 
#define bcm_port_untagged_protocol_vlan_delete \
    bcm_port_protocol_vlan_delete 
#define bcm_port_untagged_protocol_vlan_delete_all \
    bcm_port_protocol_vlan_delete_all 

#ifndef BCM_HIDE_DISPATCHABLE

/* Add or delete a protocol based vlan. */
extern int bcm_port_protocol_vlan_add(
    int unit, 
    bcm_port_t port, 
    bcm_port_frametype_t frame, 
    bcm_port_ethertype_t ether, 
    bcm_vlan_t vid);

/* Add or delete a protocol based vlan. */
extern int bcm_port_protocol_vlan_delete(
    int unit, 
    bcm_port_t port, 
    bcm_port_frametype_t frame, 
    bcm_port_ethertype_t ether);

/* Add or delete a protocol based vlan. */
extern int bcm_port_protocol_vlan_delete_all(
    int unit, 
    bcm_port_t port);

/* 
 * Configure a port to block or allow packets from a given ingress port
 * for egressing.
 */
extern int bcm_port_egress_set(
    int unit, 
    bcm_port_t port, 
    int modid, 
    bcm_pbmp_t pbmp);

/* 
 * Configure a port to block or allow packets from a given ingress port
 * for egressing.
 */
extern int bcm_port_egress_get(
    int unit, 
    bcm_port_t port, 
    int modid, 
    bcm_pbmp_t *pbmp);

/* 
 * Configure which egress ports an ingress port is permitted to forward
 * packets to.
 */
extern int bcm_port_modid_enable_set(
    int unit, 
    bcm_port_t port, 
    int modid, 
    int enable);

/* 
 * Configure which egress ports an ingress port is permitted to forward
 * packets to.
 */
extern int bcm_port_modid_enable_get(
    int unit, 
    bcm_port_t port, 
    int modid, 
    int *enable);

/* 
 * Configure which egress ports an ingress port is permitted to forward
 * packets to.
 */
extern int bcm_port_modid_egress_set(
    int unit, 
    bcm_port_t port, 
    bcm_module_t modid, 
    bcm_pbmp_t pbmp);

/* 
 * Configure which egress ports an ingress port is permitted to forward
 * packets to.
 */
extern int bcm_port_modid_egress_get(
    int unit, 
    bcm_port_t port, 
    bcm_module_t modid, 
    bcm_pbmp_t *pbmp);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Flood blocking modes. */
#define BCM_PORT_FLOOD_BLOCK_BCAST          0x1        
#define BCM_PORT_FLOOD_BLOCK_UNKNOWN_UCAST  0x2        
#define BCM_PORT_FLOOD_BLOCK_UNKNOWN_MCAST  0x4        
#define BCM_PORT_FLOOD_BLOCK_ALL            0x8        
#define BCM_PORT_FLOOD_BLOCK_UNKNOWN_IP_MCAST 0x10       
#define BCM_PORT_FLOOD_BLOCK_UNKNOWN_NONIP_MCAST 0x20       

#ifndef BCM_HIDE_DISPATCHABLE

/* Selectively block flooding traffic. */
extern int bcm_port_flood_block_set(
    int unit, 
    bcm_port_t ingress_port, 
    bcm_port_t egress_port, 
    uint32 flags);

/* Selectively block flooding traffic. */
extern int bcm_port_flood_block_get(
    int unit, 
    bcm_port_t ingress_port, 
    bcm_port_t egress_port, 
    uint32 *flags);

/* Configure a port for egress rate shaping. */
extern int bcm_port_rate_egress_set(
    int unit, 
    bcm_port_t port, 
    uint32 kbits_sec, 
    uint32 kbits_burst);

/* Get a port's egress rate shaping parameters. */
extern int bcm_port_rate_egress_get(
    int unit, 
    bcm_port_t port, 
    uint32 *kbits_sec, 
    uint32 *kbits_burst);

/* Configure a port fifos for egress rate shaping. */
extern int bcm_port_rate_egress_traffic_set(
    int unit, 
    bcm_port_t port, 
    uint32 traffic_types, 
    uint32 kbits_sec, 
    uint32 kbits_burst);

/* Get an egress port's fifo shaping parameters. */
extern int bcm_port_rate_egress_traffic_get(
    int unit, 
    bcm_port_t port, 
    uint32 *traffic_types, 
    uint32 *kbits_sec, 
    uint32 *kbits_burst);

/* Configure a port for ingress rate policing. */
extern int bcm_port_rate_ingress_set(
    int unit, 
    bcm_port_t port, 
    uint32 kbits_sec, 
    uint32 kbits_burst);

/* Configure a port for ingress rate policing. */
extern int bcm_port_rate_ingress_get(
    int unit, 
    bcm_port_t port, 
    uint32 *kbits_sec, 
    uint32 *kbits_burst);

/* 
 * Configure a port's ingress rate limiting pause frame control
 * parameters.
 */
extern int bcm_port_rate_pause_set(
    int unit, 
    bcm_port_t port, 
    uint32 kbits_pause, 
    uint32 kbits_resume);

/* 
 * Configure a port's ingress rate limiting pause frame control
 * parameters.
 */
extern int bcm_port_rate_pause_get(
    int unit, 
    bcm_port_t port, 
    uint32 *kbits_pause, 
    uint32 *kbits_resume);

/* Control the sampling of packets ingressing or egressing a port. */
extern int bcm_port_sample_rate_set(
    int unit, 
    bcm_port_t port, 
    int ingress_rate, 
    int egress_rate);

/* Control the sampling of packets ingressing or egressing a port. */
extern int bcm_port_sample_rate_get(
    int unit, 
    bcm_port_t port, 
    int *ingress_rate, 
    int *egress_rate);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Double tagging modes. */
#define BCM_PORT_DTAG_MODE_NONE             0          /* No double tagging. */
#define BCM_PORT_DTAG_MODE_INTERNAL         1          /* Service Provider port. */
#define BCM_PORT_DTAG_MODE_EXTERNAL         2          /* Customer port. */
#define BCM_PORT_DTAG_REMOVE_EXTERNAL_TAG   4          /* Remove customer tag. */
#define BCM_PORT_DTAG_ADD_EXTERNAL_TAG      8          /* Add customer tag. */
#define BCM_PORT_DTAG_MODE_TRANSPARENT      16         /* Transparent port, all
                                                          packets assume port's
                                                          default VID. */

#ifndef BCM_HIDE_DISPATCHABLE

/* Set or retrieve the current double tagging mode for a port. */
extern int bcm_port_dtag_mode_set(
    int unit, 
    bcm_port_t port, 
    int mode);

/* Set or retrieve the current double tagging mode for a port. */
extern int bcm_port_dtag_mode_get(
    int unit, 
    bcm_port_t port, 
    int *mode);

/* Set the default tag protocol ID (TPID) for the specified port. */
extern int bcm_port_tpid_set(
    int unit, 
    bcm_port_t port, 
    uint16 tpid);

/* Set the default tag protocol ID (TPID) for the specified port. */
extern int bcm_port_tpid_get(
    int unit, 
    bcm_port_t port, 
    uint16 *tpid);

/* Add an allowed outer tag protocol ID (TPID) for the specified port. */
extern int bcm_port_tpid_add(
    int unit, 
    bcm_port_t port, 
    uint16 tpid, 
    int color_select);

/* Delete allowed outer tag protocol ID (TPID) for the specified port. */
extern int bcm_port_tpid_delete(
    int unit, 
    bcm_port_t port, 
    uint16 tpid);

/* Delete allowed outer tag protocol ID (TPID) for the specified port. */
extern int bcm_port_tpid_delete_all(
    int unit, 
    bcm_port_t port);

/* Set the default tag protocol ID (TPID) for the specified port. */
extern int bcm_port_inner_tpid_set(
    int unit, 
    bcm_port_t port, 
    uint16 tpid);

/* Set the default tag protocol ID (TPID) for the specified port. */
extern int bcm_port_inner_tpid_get(
    int unit, 
    bcm_port_t port, 
    uint16 *tpid);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_cable_state_t */
typedef _shr_port_cable_state_t bcm_port_cable_state_t;

#define BCM_PORT_CABLE_STATE_OK         _SHR_PORT_CABLE_STATE_OK 
#define BCM_PORT_CABLE_STATE_OPEN       _SHR_PORT_CABLE_STATE_OPEN 
#define BCM_PORT_CABLE_STATE_SHORT      _SHR_PORT_CABLE_STATE_SHORT 
#define BCM_PORT_CABLE_STATE_OPENSHORT  _SHR_PORT_CABLE_STATE_OPENSHORT 
#define BCM_PORT_CABLE_STATE_CROSSTALK  _SHR_PORT_CABLE_STATE_CROSSTALK 
#define BCM_PORT_CABLE_STATE_UNKNOWN    _SHR_PORT_CABLE_STATE_UNKNOWN 
#define BCM_PORT_CABLE_STATE_COUNT      _SHR_PORT_CABLE_STATE_COUNT 

/* bcm_port_cable_diag_t */
typedef _shr_port_cable_diag_t bcm_port_cable_diag_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Perform cable diagnostics on the specified port. */
extern int bcm_port_cable_diag(
    int unit, 
    bcm_port_t port, 
    bcm_port_cable_diag_t *status);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_L3_MODIFY_NO_SRCMAC    0x0001     
#define BCM_PORT_L3_MODIFY_NO_DSTMAC    0x0002     
#define BCM_PORT_L3_MODIFY_NO_TTL       0x0004     
#define BCM_PORT_L3_MODIFY_NO_VLAN      0x0008     

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set the L3 unicast packet modification operations of a port. */
extern int bcm_port_l3_modify_set(
    int unit, 
    bcm_port_t port, 
    uint32 flags);

/* Get or set the L3 unicast packet modification operations of a port. */
extern int bcm_port_l3_modify_get(
    int unit, 
    bcm_port_t port, 
    uint32 *flags);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_IPMC_MODIFY_NO_SRCMAC  0x0001     
#define BCM_PORT_IPMC_MODIFY_NO_TTL     0x0004     

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set the L3 multicast packet modification operations of a port. */
extern int bcm_port_ipmc_modify_set(
    int unit, 
    bcm_port_t port, 
    uint32 flags);

/* Get or set the L3 multicast packet modification operations of a port. */
extern int bcm_port_ipmc_modify_get(
    int unit, 
    bcm_port_t port, 
    uint32 *flags);

#endif /* BCM_HIDE_DISPATCHABLE */

/* 
 * Port information valid fields
 * 
 * Each field in the bcm_port_info_t structure has a corresponding mask
 * bit to control whether to get or set that value during the execution
 * of the bcm_port_selective_get/_set functions. The OR of all requested
 * ATTR masks should be stored in the action_mask field and the OR of all
 * requested ATTR2 masks should be stored in the action_mask2 field of
 * the bcm_port_info_t before calling the functions.
 */
#define BCM_PORT_ATTR_ENABLE_MASK           0x00000001 
#define BCM_PORT_ATTR_LINKSTAT_MASK         0x00000002 /* Get only. */
#define BCM_PORT_ATTR_AUTONEG_MASK          0x00000004 
#define BCM_PORT_ATTR_SPEED_MASK            0x00000008 
#define BCM_PORT_ATTR_DUPLEX_MASK           0x00000010 
#define BCM_PORT_ATTR_LINKSCAN_MASK         0x00000020 
#define BCM_PORT_ATTR_LEARN_MASK            0x00000040 
#define BCM_PORT_ATTR_DISCARD_MASK          0x00000080 
#define BCM_PORT_ATTR_VLANFILTER_MASK       0x00000100 
#define BCM_PORT_ATTR_UNTAG_PRI_MASK        0x00000200 
#define BCM_PORT_ATTR_UNTAG_VLAN_MASK       0x00000400 
#define BCM_PORT_ATTR_STP_STATE_MASK        0x00000800 
#define BCM_PORT_ATTR_PFM_MASK              0x00001000 
#define BCM_PORT_ATTR_LOOPBACK_MASK         0x00002000 
#define BCM_PORT_ATTR_PHY_MASTER_MASK       0x00004000 
#define BCM_PORT_ATTR_INTERFACE_MASK        0x00008000 
#define BCM_PORT_ATTR_PAUSE_TX_MASK         0x00010000 
#define BCM_PORT_ATTR_PAUSE_RX_MASK         0x00020000 
#define BCM_PORT_ATTR_PAUSE_MAC_MASK        0x00040000 
#define BCM_PORT_ATTR_LOCAL_ADVERT_MASK     0x00080000 
#define BCM_PORT_ATTR_REMOTE_ADVERT_MASK    0x00100000 /* Get only. */
#define BCM_PORT_ATTR_ENCAP_MASK            0x00200000 
#define BCM_PORT_ATTR_RATE_MCAST_MASK       0x00400000 
#define BCM_PORT_ATTR_RATE_BCAST_MASK       0x00800000 
#define BCM_PORT_ATTR_RATE_DLFBC_MASK       0x01000000 
#define BCM_PORT_ATTR_SPEED_MAX_MASK        0x02000000 /* Get only. */
#define BCM_PORT_ATTR_ABILITY_MASK          0x04000000 /* Get only. */
#define BCM_PORT_ATTR_FRAME_MAX_MASK        0x08000000 
#define BCM_PORT_ATTR_MDIX_MASK             0x10000000 
#define BCM_PORT_ATTR_MDIX_STATUS_MASK      0x20000000 
#define BCM_PORT_ATTR_MEDIUM_MASK           0x40000000 
#define BCM_PORT_ATTR_FAULT_MASK            0x80000000 /* Get only. */
#define BCM_PORT_ATTR2_PORT_ABILITY         0x00000001 

/* Backward compatibility. */
#define BCM_PORT_ATTR_SPEED_MAX BCM_PORT_ATTR_SPEED_MAX_MASK 
#define BCM_PORT_ATTR_ABILITY   BCM_PORT_ATTR_ABILITY_MASK 

#define BCM_PORT_ATTR_ALL_MASK      0xffffffff 
#define BCM_PORT_ATTR_PAUSE_MASK    \
    (BCM_PORT_ATTR_PAUSE_TX_MASK    | \
     BCM_PORT_ATTR_PAUSE_RX_MASK) 
#define BCM_PORT_ATTR_RATE_MASK     \
    (BCM_PORT_ATTR_RATE_MCAST_MASK  | \
     BCM_PORT_ATTR_RATE_BCAST_MASK  | \
     BCM_PORT_ATTR_RATE_DLFBC_MASK) 

/* Attributes that can be controlled on BCM5670/75. */
#define BCM_PORT_HERC_ATTRS     \
    (BCM_PORT_ATTR_ENABLE_MASK      | \
     BCM_PORT_ATTR_LINKSTAT_MASK    | \
     BCM_PORT_ATTR_SPEED_MASK       | \
     BCM_PORT_ATTR_DUPLEX_MASK      | \
     BCM_PORT_ATTR_LINKSCAN_MASK    | \
     BCM_PORT_ATTR_INTERFACE_MASK   | \
     BCM_PORT_ATTR_LOOPBACK_MASK    | \
     BCM_PORT_ATTR_PAUSE_TX_MASK    | \
     BCM_PORT_ATTR_PAUSE_RX_MASK    | \
     BCM_PORT_ATTR_PAUSE_MAC_MASK   | \
     BCM_PORT_ATTR_FRAME_MAX_MASK   | \
     BCM_PORT_ATTR_ENCAP_MASK) 

/* Attributes specific to XGS devices. */
#define BCM_PORT_XGS_ATTRS      (BCM_PORT_ATTR_ENCAP_MASK) 

/* Auto-negotiated values. */
#define BCM_PORT_AN_ATTRS       \
    (BCM_PORT_ATTR_SPEED_MASK       | \
     BCM_PORT_ATTR_DUPLEX_MASK      | \
     BCM_PORT_ATTR_PAUSE_MASK) 

/* bcm_port_info_s */
typedef struct bcm_port_info_s {
    uint32 action_mask;                 /* BCM_PORT_ATTR_xxx. */
    uint32 action_mask2;                /* BCM_PORT_ATTR2_xxx. */
    int enable; 
    int linkstatus; 
    int autoneg; 
    int speed; 
    int duplex; 
    int linkscan; 
    uint32 learn; 
    int discard; 
    uint32 vlanfilter; 
    int untagged_priority; 
    bcm_vlan_t untagged_vlan; 
    int stp_state; 
    int pfm; 
    int loopback; 
    int phy_master; 
    bcm_port_if_t interface; 
    int pause_tx; 
    int pause_rx; 
    int encap_mode; 
    bcm_mac_t pause_mac; 
    bcm_port_abil_t local_advert; 
    bcm_port_ability_t local_ability; 
    int remote_advert_valid; 
    bcm_port_abil_t remote_advert; 
    bcm_port_ability_t remote_ability; 
    int mcast_limit; 
    int mcast_limit_enable; 
    int bcast_limit; 
    int bcast_limit_enable; 
    int dlfbc_limit; 
    int dlfbc_limit_enable; 
    int speed_max; 
    bcm_port_abil_t ability; 
    bcm_port_ability_t port_ability; 
    int frame_max; 
    bcm_port_mdix_t mdix; 
    bcm_port_mdix_status_t mdix_status; 
    bcm_port_medium_t medium; 
    uint32 fault; 
} bcm_port_info_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set multiple port characteristics. */
extern int bcm_port_info_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_info_t *info);

/* Get or set multiple port characteristics. */
extern int bcm_port_info_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_info_t *info);

/* Get or set multiple port characteristics. */
extern int bcm_port_selective_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_info_t *info);

/* Get or set multiple port characteristics. */
extern int bcm_port_selective_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_info_t *info);

/* Get or set multiple port characteristics. */
extern int bcm_port_info_restore(
    int unit, 
    bcm_port_t port, 
    bcm_port_info_t *info);

/* Get or set multiple port characteristics. */
extern int bcm_port_info_save(
    int unit, 
    bcm_port_t port, 
    bcm_port_info_t *info);

/* Gets the physical driver name. */
extern int bcm_port_phy_drv_name_get(
    int unit, 
    bcm_port_t port, 
    char *name, 
    int len);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_pon_info_s */
typedef struct bcm_port_pon_info_s {
    int llid; 
    int enable; 
    int linkstatus; 
    int oam_discovery_status; 
    int loopback; 
    bcm_mac_t olt_mac_addr; 
} bcm_port_pon_info_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set multiple characteristics for PON port and logical link. */
extern int bcm_port_pon_info_get(
    int unit, 
    bcm_port_t pon_port, 
    bcm_port_pon_info_t *info);

/* Get or set multiple characteristics for PON port and logical link. */
extern int bcm_port_pon_info_set(
    int unit, 
    bcm_port_t pon_port, 
    bcm_port_pon_info_t *info);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Port link fault signalling. */
#define BCM_PORT_FAULT_LOCAL    0x0001     
#define BCM_PORT_FAULT_REMOTE   0x0002     

/* 
 * Port Rate Egress Traffic identifiers for QE Fifo Selectors into
 * Shapers.
 */
#define BCM_PORT_RATE_TRAFFIC_UC_EF         0x0001     
#define BCM_PORT_RATE_TRAFFIC_UC_NON_EF     0x0002     
#define BCM_PORT_RATE_TRAFFIC_NON_UC_EF     0x0200     
#define BCM_PORT_RATE_TRAFFIC_NON_UC_NON_EF 0x0100     

#ifndef BCM_HIDE_DISPATCHABLE

/* Get link fault type. */
extern int bcm_port_fault_get(
    int unit, 
    bcm_port_t port, 
    uint32 *flags);

/* 
 * Set or get port index of a trunk for ingress port that is used to
 * select the egress port in the trunk.
 */
extern int bcm_port_trunk_index_set(
    int unit, 
    bcm_port_t port, 
    int port_index);

/* 
 * Set or get port index of a trunk for ingress port that is used to
 * select the egress port in the trunk.
 */
extern int bcm_port_trunk_index_get(
    int unit, 
    bcm_port_t port, 
    int *port_index);

/* Set or retrieve color assignment for a given port and priority. */
extern int bcm_port_priority_color_set(
    int unit, 
    bcm_port_t port, 
    int prio, 
    bcm_color_t color);

/* Set or retrieve color assignment for a given port and priority. */
extern int bcm_port_priority_color_get(
    int unit, 
    bcm_port_t port, 
    int prio, 
    bcm_color_t *color);

/* Set or retrieve color assignment for a given port and CFI. */
extern int bcm_port_cfi_color_set(
    int unit, 
    bcm_port_t port, 
    int cfi, 
    bcm_color_t color);

/* Set or retrieve color assignment for a given port and CFI. */
extern int bcm_port_cfi_color_get(
    int unit, 
    bcm_port_t port, 
    int cfi, 
    bcm_color_t *color);

/* 
 * Map the incoming packet priority and CFI to internal priority and
 * color.
 */
extern int bcm_port_vlan_priority_map_set(
    int unit, 
    bcm_port_t port, 
    int pkt_pri, 
    int cfi, 
    int internal_pri, 
    bcm_color_t color);

/* 
 * Map the incoming packet priority and CFI to internal priority and
 * color.
 */
extern int bcm_port_vlan_priority_map_get(
    int unit, 
    bcm_port_t port, 
    int pkt_pri, 
    int cfi, 
    int *internal_pri, 
    bcm_color_t *color);

/* 
 * Map the internal priority and color to outgoing packet priority and
 * CFI.
 */
extern int bcm_port_vlan_priority_unmap_set(
    int unit, 
    bcm_port_t port, 
    int internal_pri, 
    bcm_color_t color, 
    int pkt_pri, 
    int cfi);

/* 
 * Map the internal priority and color to outgoing packet priority and
 * CFI.
 */
extern int bcm_port_vlan_priority_unmap_get(
    int unit, 
    bcm_port_t port, 
    int internal_pri, 
    bcm_color_t color, 
    int *pkt_pri, 
    int *cfi);

/* 
 * Map the incoming packet priority and CFI to internal priority and
 * color on a per-port per-vlan basis.
 */
extern int bcm_port_vlan_pri_map_set(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vlan, 
    int pkt_pri, 
    int cfi, 
    int internal_pri, 
    bcm_color_t color);

/* 
 * Get the mapping of incoming packet priority and CFI to internal
 * priority and color.
 */
extern int bcm_port_vlan_pri_map_get(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vlan, 
    int pkt_pri, 
    int cfi, 
    int *internal_pri, 
    bcm_color_t *color);

/* Map the incoming IP packet DSCP to internal priority and color. */
extern int bcm_port_vlan_dscp_map_set(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vlan, 
    int dscp, 
    int internal_pri, 
    bcm_color_t color);

/* 
 * Get the mapping of incoming IP packet DSCP to internal priority and
 * color.
 */
extern int bcm_port_vlan_dscp_map_get(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vlan, 
    int dscp, 
    int *internal_pri, 
    bcm_color_t *color);

/* Map the internal priority and color to outgoing packet dscp. */
extern int bcm_port_dscp_unmap_set(
    int unit, 
    bcm_port_t port, 
    int internal_pri, 
    bcm_color_t color, 
    int pkt_dscp);

/* 
 * Get the mapping of internal priority and color to outgoing packet
 * dscp.
 */
extern int bcm_port_dscp_unmap_get(
    int unit, 
    bcm_port_t port, 
    int internal_pri, 
    bcm_color_t color, 
    int *pkt_dscp);

/* 
 * Set the mapping of wire/packet pri and cfi to internal priority and
 * color.
 */
extern int bcm_port_vlan_priority_mapping_set(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vid, 
    int pkt_pri, 
    int cfi, 
    bcm_priority_mapping_t *pri_map);

/* 
 * Get the mapping of wire/packet pri and cfi to internal priority and
 * color.
 */
extern int bcm_port_vlan_priority_mapping_get(
    int unit, 
    bcm_port_t port, 
    bcm_vlan_t vid, 
    int pkt_pri, 
    int cfi, 
    bcm_priority_mapping_t *pri_map);

/* Set the inner tag value to be added to the outgoing packet. */
extern int bcm_port_vlan_inner_tag_set(
    int unit, 
    bcm_port_t port, 
    uint16 inner_tag);

/* Set the inner tag value to be added to the outgoing packet. */
extern int bcm_port_vlan_inner_tag_get(
    int unit, 
    bcm_port_t port, 
    uint16 *inner_tag);

/* Set or get egress override port. */
extern int bcm_port_force_forward_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_t egr_port, 
    int enable);

/* Set or get egress override port. */
extern int bcm_port_force_forward_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_t *egr_port, 
    int *enabled);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_FORCE_FORWARD_DISABLE  0x0        /* Normal switching */
#define BCM_PORT_FORCE_FORWARD_ALL      0x1        /* Redirect all ingress port
                                                      traffic to specified port */
#define BCM_PORT_FORCE_FORWARD_LOCAL    0x2        /* Redirect all ingress port
                                                      traffic which would
                                                      otherwise go to a local
                                                      port to the specified port */

#ifndef BCM_HIDE_DISPATCHABLE

/* Set egress override port mode. */
extern int bcm_port_force_forward_mode_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_t egr_port, 
    uint32 flags);

/* Get egress override port. */
extern int bcm_port_force_forward_mode_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_t *egr_port, 
    uint32 *flags);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_class_e */
typedef enum bcm_port_class_e {
    bcmPortClassFieldLookup, 
    bcmPortClassFieldIngress, 
    bcmPortClassFieldEgress, 
    bcmPortClassVlanTranslateEgress, 
    bcmPortClassIngress 
} bcm_port_class_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* 
 * Set or get port classification ID to aggregate a group of ports for
 * further processing such as Vlan translation and field processing.
 */
extern int bcm_port_class_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_class_t pclass, 
    uint32 class_id);

/* 
 * Set or get port classification ID to aggregate a group of ports for
 * further processing such as Vlan translation and field processing.
 */
extern int bcm_port_class_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_class_t pclass, 
    uint32 *class_id);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Features that can be controlled on a per-port basis. */
typedef enum bcm_port_control_e {
    bcmPortControlBridge,               /* Enable local port bridging. */
    bcmPortControlTrunkHashSet,         /* Select one of the two sets of hash
                                           bits selection configuration for
                                           trunking. */
    bcmPortControlFabricTrunkHashSet,   /* Select one of the two sets of hash
                                           bits selection configuration for
                                           fabric trunking. */
    bcmPortControlECMPHashSet,          /* Select one of the two sets of hash
                                           bits selection configuration for
                                           ECMP. */
    bcmPortControlLoadBalanceHashSet,   /* Select one of the two sets of hash
                                           bits selection configuration for LBID
                                           to be populated in HiGig2 header. */
    bcmPortControlLoadBalancingNumber,  /* Assigns the Load Balancing Number of
                                           this port for HiGig2 headers. */
    bcmPortControlErrorSymbolDetect,    /* Enable or disable XAUI |E| monitoring
                                           feature  for port's XAUI lanes. */
    bcmPortControlErrorSymbolCount,     /* Get the number of XAUI |E| symbol
                                           occured since last read. Setting any
                                           value to the count will set it to
                                           zero. */
    bcmPortControlIP4,                  /* Enable IPv4 Routing on port. */
    bcmPortControlIP6,                  /* Enable IPv6 Routing on port. */
    bcmPortControlIP4Mcast,             /* Enable IPv4 Multicast on port. */
    bcmPortControlIP6Mcast,             /* Enable IPv6 Multicast on port. */
    bcmPortControlIP4McastL2,           /* Enable L2 switching on IPv4 IPMC
                                           packets based on (SG,*G) instead of
                                           (DMAC,VLAN). */
    bcmPortControlIP6McastL2,           /* Enable L2 switching on IPv6 IPMC
                                           packets based on (SG,*G) instead of
                                           (DMAC,VLAN). */
    bcmPortControlMpls,                 /* Enable MPLS on the port ingress. */
    bcmPortControlPassControlFrames,    /* Enable controls frames on port. */
    bcmPortControlFilterLookup,         /* Enable port lookup Field Processor. */
    bcmPortControlFilterIngress,        /* Enable ingress Field Processor on
                                           port. */
    bcmPortControlFilterEgress,         /* Enable egress Field Processor on
                                           port. */
    bcmPortControlFrameSpacingStretch,  /* One byte of inter packet gap is added
                                           for specified number of packet data
                                           bytes. If the value is 10, one byte
                                           of IPG is added for each 10 byte of
                                           packet data. */
    bcmPortControlPreservePacketPriority, /* Preserve packet original IEEE 802.1p
                                           priority. */
    bcmPortControlLearnClassEnable,     /* Enable class based station movement
                                           checks. */
    bcmPortControlMplsIngressPortCheck, /* Enable Mpls ILM ingress port checks. */
    bcmPortControlMplsMultiLabelSwitching, /* Enable Mpls multi label switching */
    bcmPortControlTrustIncomingVlan,    /* Trust incoming packet's Vlan tag */
    bcmPortControlDoNotCheckVlan,       /* Enable/disable spanning tree and Vlan
                                           membership checks. */
    bcmPortControlIEEE8021ASEnableIngress, /* Enable/disable ingress processing of
                                           IEEE 802.1AS protocol packets. */
    bcmPortControlIEEE8021ASEnableEgress, /* Enable/disable egress processing of
                                           IEEE 802.1AS protocol packets. */
    bcmPortControlPrbsMode,             /* PRBS location - 0=>Phy PRBS 1=>MAC/SI
                                           Port */
    bcmPortControlPrbsPolynomial,       /* Assigns PRBS polynomial,
                                           BCM_PORT_PRBS_POLYNOMIAL_ */
    bcmPortControlPrbsTxInvertData,     /* Configure inversion of Tx data */
    bcmPortControlPrbsForceTxError,     /* Configure insertion of Tx errors */
    bcmPortControlPrbsTxEnable,         /* Enable Tx PRBS */
    bcmPortControlPrbsRxEnable,         /* Enable Rx PRBS */
    bcmPortControlPrbsRxStatus,         /* PRBS Rx status */
    bcmPortControlSerdesDriverStrength, /* Assigns Driver Strength */
    bcmPortControlSerdesDriverEqualization, /* Assigns Driver Equalization */
    bcmPortControlSerdesDriverEqualizationFarEnd, /* Informs software of far end transmit
                                           driver equalization setting for
                                           tuning */
    bcmPortControlSerdesDriverTune,     /* Start hardware receive equalization
                                           tuning */
    bcmPortControlSerdesDriverEqualizationTuneStatusFarEnd, /* Get results of tune operation which
                                           include suggested far end
                                           equalization update */
    bcmPortControlAbility,              /* Assigns Port ability,
                                           BCM_PORT_ABILITY_ */
    bcmPortControlMacInMac,             /* Enable/Disable MiM frame processing */
    bcmPortControlOamLoopback,          /* Enable/Disable 802.3 Clause 57 Oam
                                           Loopback */
    bcmPortControlEgressModifyDscp,     /* Enable outer ip header dscp
                                           modification. */
    bcmPortControlEgressVlanPriUsesPktPri, /* If set, outgoing packets derive their
                                           priority from the incoming priority */
    bcmPortControlEgressVlanCfiUsesPktPri, /* If set, outgoing packets derive their
                                           cfi from the incoming priority */
    bcmPortControlPacketFlowMode,       /* Enable/Disable requeue for hybrid
                                           mode */
    bcmPortControlTrain,                /* Start/stop training sequence */
    bcmPortControlRxEnable,             /* Rx enable/disable */
    bcmPortControlTxEnable,             /* Tx enable/disable */
    bcmPortControlRxLink,               /* Retreives Rx Status */
    bcmPortControlTxLink,               /* Retreives Tx Status */
    bcmPortControlIpfixRate,            /* Set IPFIX flow rate meter id */
    bcmPortControlOAMEnable,            /* Enable reception of OAM messages */
    bcmPortControlCustomerQueuing,      /* Enable customer domain queuing */
    bcmPortControlFabricKnockoutId,     /* sets port identifier, used for source
                                           knockout functionality */
    bcmPortControlLanes,                /* Sets the number of active lanes for a
                                           port that can be dynamically
                                           hot-swapped between one 12G port
                                           (value = 1) or four 1G ports (value =
                                           4). */
    bcmPortControlEgressNonUnicastLossless, /* Enable/Disable multicast Lossless
                                           operation */
    bcmPortControlPFCEthertype,         /* Priority Flow Control packet
                                           Ethertype */
    bcmPortControlPFCOpcode,            /* Priority Flow Control packet opcode */
    bcmPortControlPFCReceive,           /* Priority Flow Control packet receive
                                           enable */
    bcmPortControlPFCTransmit,          /* Priority Flow Control packet transmit
                                           enable */
    bcmPortControlPFCClasses,           /* Priority Flow Control number of
                                           classes */
    bcmPortControlPFCPassFrames,        /* Allow Priority Flow Control packets
                                           into switch device */
    bcmPortControlPFCDestMacOui,        /* Priority Flow Control packet
                                           destination MAC address, upper three
                                           bytes */
    bcmPortControlPFCDestMacNonOui,     /* Priority Flow Control packet
                                           destination MAC address, lower three
                                           bytes */
    bcmPortControlPFCRefreshTime,       /* Priority Flow Control refresh time */
    bcmPortControlVrf,                  /* Enable per-port VRF to override
                                           per-Vlan VRF */
    bcmPortControlL3Ingress,            /* Enable per-port L3-IIF for IP traffic */
    bcmPortControlIngressRateControlDrop, /* Packets over rate control limit
                                           should be dropped or paused */
    bcmPortControlL2Learn,              /* Configure L2 learning behavior using
                                           BCM_PORT_LEARN_xxx flags */
    bcmPortControlL2Move,               /* Configure L2 station movement
                                           behavior using BCM_PORT_LEARN_xxx
                                           flags */
    bcmPortControlForwardStaticL2MovePkt, /* Allow forwarding L2 packet even if L2
                                           movement is detected against an
                                           existing static entry in L2 table */
    bcmPortControlLinkFaultLocalEnable, /* Enable local LSS message processing */
    bcmPortControlLinkFaultRemoteEnable, /* Enable remote LSS message processing */
    bcmPortControlLinkFaultLocal,       /* Read local LSS message processing
                                           status */
    bcmPortControlLinkFaultRemote,      /* Read remote LSS message processing
                                           status */
    bcmPortControlTimestampTransmit,    /* Read the timestamp value assigned to
                                           TX packet */
    bcmPortControlTimestampEnable,      /* Set the port to be capable of
                                           timestamping TX packet */
    bcmPortControlTCPriority,           /* Indicates the default Traffic Class
                                           attributes assoiated with the port */
    bcmPortControlDropPrecedence,       /* Indicates the default Drop Precedence
                                           attributes assoiated with the port */
    bcmPortControlFabricQueue,          /* Enable ext header on Higig port. */
    bcmPortControlLinkdownTransmit,     /* Enable transmission when linkdown */
    bcmPortControlEEETransmitWakeTime,  /* Time(in microsecs) to wait before
                                           transmitter can begin transmitting
                                           leaving Low Power Idle State */
    bcmPortControlEEEReceiveWakeTime,   /* Time(in microsecs) Receiver counts
                                           for SLEEP or IDLE symbols to move to
                                           Active from Low Power Idle State */
    bcmPortControlEEETransmitSleepTime, /* Time(in microsecs) Tranmitter sends
                                           SLEEP symbols before going to QUIET
                                           state */
    bcmPortControlEEEReceiveSleepTime,  /* Time(in microsecs) Receiver is in
                                           SLEEP state before entering QUIET
                                           state */
    bcmPortControlEEETransmitQuietTime, /* Time(in microsecs) transmit stays in
                                           Quiet state before entering REFRESH
                                           state */
    bcmPortControlEEEReceiveQuietTime,  /* Time(in microsecs) Receiver stays in
                                           Quiet state before it expects REFRESH
                                           signal */
    bcmPortControlEEETransmitRefreshTime, /* Time(in microsecs) transmitter stays
                                           in Refresh state */
    bcmPortControlSerdesTuneMarginMax,  /* SerDes max tune margin value */
    bcmPortControlSerdesTuneMarginMode, /* SerDes in tune margin mode */
    bcmPortControlSerdesTuneMarginValue, /* Value used to measure tune margin */
    bcmPortControlStatOversize,         /* Threshold above which packet will be
                                           counted as oversized */
    bcmPortControlEEEEnable,            /* Enable/Disable Energy Efficient
                                           Ethernet */
    bcmPortControlEEETransmitIdleTime,  /* Time (in microsecs) for which
                                           condition to move to LPI state is
                                           satisfied, at the end of which MAC
                                           transitions to LPI state */
    bcmPortControlEEETransmitEventCount, /* Number of time MAC TX enters LPI
                                           state for a given measurement
                                           interval */
    bcmPortControlEEETransmitDuration,  /* Time (in microseconds) for which MAC
                                           TX is in LPI state during a
                                           measurement interval */
    bcmPortControlEEEReceiveEventCount, /* Number of time MAC RX enters LPI
                                           state for a given measurement
                                           interval */
    bcmPortControlEEEReceiveDuration,   /* Time (in microseconds) for which MAC
                                           RX is in LPI state during a
                                           measurement interval */
    bcmPortControlEEETransmitIdleTimeHund, /* The same as
                                           PortControlEEETransmitIdleTime for
                                           the link speed at 100MB data rate */
    bcmPortControlEEETransmitWakeTimeHund, /* The same as
                                           PortControlEEETransmitWakeTime for
                                           the link speed at 100MB data rate */
    bcmPortControlEEETransmitMinLPITime, /* Time (in microseconds) MAC stay in
                                           LPI state before leaving it */
    bcmPortControlEEETransmitMinLPITimeHund, /* The same as
                                           PortControlEEETransmitMinLPITime for
                                           the link speed at 100MB data rate */
    bcmPortControlNivAccessVirtualInterfaceId, /* Source virtual interface identifier
                                           (value range 0-0xfff) */
    bcmPortControlNivNonVntagDrop,      /* Set Ingress drop control, if VNTAG is
                                           not present  (value = TRUE/FALSE) */
    bcmPortControlNivVntagDrop,         /* Set Ingress drop control, if VNTAG is
                                           present (value = TRUE/FALSE) */
    bcmPortControlNivNonVntagAdd,       /* Set ADD tag action, when VNTAG is not
                                           present(value = TRUE/FALSE) */
    bcmPortControlNivVntagIngressReplace, /* Set REPLACE Ingress tag action, when
                                           VNTAG is present (value = TRUE/FALSE) */
    bcmPortControlNivVntagEgressReplace, /* Set REPLACE Egress tag action, when
                                           VNTAG is present (value = TRUE/FALSE) */
    bcmPortControlNivVntagIngressDelete, /* Set DELETE Ingress tag action, when
                                           VNTAG is present (value = TRUE/FALSE) */
    bcmPortControlNivVntagEgressDelete, /* Set DELETE Egress tag action, when
                                           VNTAG is present (value = TRUE/FALSE) */
    bcmPortControlNivRpfCheck,          /* Set incoming packet VNTAG.SRC_VIF RPF
                                           check control (value = TRUE/FALSE) */
    bcmPortControlNivSourceKnockout,    /* Set outgoing packet NIV pruning check
                                           control (value = TRUE/FALSE) */
    bcmPortControlNivForwardPort,       /* Set destination port for forwarding -
                                           mainly for upstream traffic only, but
                                           use -1 as special to flag the port as
                                           uplink port (value = local port
                                           number or -1) */
    bcmPortControlNivType,              /* Set NIV port type (enumerated value
                                           within bcm_port_niv_type_t) */
    bcmPortControlNivNameSpace,         /* Set namespace value (value range
                                           0-0xfff) */
    bcmPortControlRemoteCpuEnable,      /* Enables the port to accept packets
                                           for and from Remote CPU */
    bcmPortControlArbiterActive,        /* Indicates if the SCI link is active
                                           and its arbiter association. -1
                                           indicates disabled, 0 indicates
                                           active and associted with Arbiter 0,
                                           1 indicates active and associated
                                           with Arbiter 1 */
    bcmPortControlArbiterForceDown,     /* Status to be indicated to arbiter.
                                           TRUE forces Down, FALSE does not
                                           force down */
    bcmPortControlEgressModifyECN,      /* Enable ip header ECN modification. */
    bcmPortControlTrill,                /* Enable/Disable TRILL frame processing
                                           (value = TRUE/FALSE) */
    bcmPortControlTrillAllow,           /* Allow TRILL frames (value =
                                           TRUE/FALSE) */
    bcmPortControlNonTrillAllow,        /* Allow Non-TRILL frames (value =
                                           TRUE/FALSE) */
    bcmPortControlTrillCoreISISToCPU,   /* Core IS-IS frames received, Send to
                                           CPU (value = TRUE/FALSE) */
    bcmPortControlTrillHashSelect,      /* Select one of 2 sets of configuration
                                           for TRILL ECMP hashing (value = 1/0 ) */
    bcmPortControlFabricHeaderFormat,   /* Select appropriate fabric header
                                           type. */
    bcmPortControlFilterTcpUdpPktEnable, /* Enable the AutoVoIP function to
                                           filetr the TCP and UDP packets */
    bcmPortControlFabricSourceKnockout, /* Disables packet forwarding to
                                           non-trunk port on local modid */
    bcmPortControlRegex,                /* Enable/Disable tracking of IPv4 flows */
    bcmPortControlRegexTcp,             /* Enable/Disable tracking of IPv6 flows */
    bcmPortControlRegexUdp,             /* Enable/Disable tracking of IPv4 UDP
                                           flows */
    bcmPortControlPonEncryptKeyExpiryTime, /* Set timeout value for encryption keys
                                           (s) */
    bcmPortControlPonHoldoverState,     /* Enable holdover state */
    bcmPortControlPonHoldoverTime,      /* Set holdover time (ms) */
    bcmPortControlPonMultiLlid,         /* Set LLID number */
    bcmPortControlPonFecMode,           /* Set FEC mode on Rx and Tx together,
                                           Rx/Tx off (value = 0), Rx on and Tx
                                           off (value = 1), Rx off and Tx on
                                           (value = 2), Rx/Tx on (value = 3) or
                                           FEC is settable per link (value = 4) */
    bcmPortControlPonUserTraffic,       /* Enable user traffic */
    bcmPortControlEthPortAutoNegFailureAlarmState, /* Alarm on/off state of the
                                           EthPortAutoNegFailure */
    bcmPortControlEthPortLosAlarmState, /* Alarm on/off state of the EthPortLos */
    bcmPortControlEthPortFailureAlarmState, /* Alarm on/off state of the
                                           EthPortFailure */
    bcmPortControlEthPortLoopbackAlarmState, /* Alarm on/off state of the
                                           EthPortLoopback */
    bcmPortControlEthPortCongestionAlarmState, /* Alarm on/off state of the
                                           EthPortCongestion */
    bcmPortControlMplsEntropyHashSet    /* Select one of 2 sets of configuration
                                           for MPLS Entropy hashing (value =
                                           1/0) */
} bcm_port_control_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Get or set various features at the port level. */
extern int bcm_port_control_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_control_t type, 
    int value);

/* Get or set various features at the port level. */
extern int bcm_port_control_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_control_t type, 
    int *value);

/* 
 * Given a controlling port, this API returns the set of ancillary
 * ports belonging to the group (port block) that can be configured to
 * operate
 * either as a single high-speed port or multiple GE ports. If the input
 * port is
 * not a controlling port BCM_E_PORT error will be returned.
 */
extern int bcm_port_subsidiary_ports_get(
    int unit, 
    bcm_port_t port, 
    bcm_pbmp_t *pbmp);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_info_t_init */
extern void bcm_port_info_t_init(
    bcm_port_info_t *info);

/* bcm_port_ability_t_init */
extern void bcm_port_ability_t_init(
    bcm_port_ability_t *ability);

/* bcm_phy_config_t_init */
extern void bcm_phy_config_t_init(
    bcm_phy_config_t *config);

/* Initialize a Port Configuration structure. */
extern void bcm_port_config_t_init(
    bcm_port_config_t *pconfig);

/* Initialize a Port Encapsulation Configuration structure. */
extern void bcm_port_encap_config_t_init(
    bcm_port_encap_config_t *encap_config);

#define BCM_PORT_CONGESTION_CONFIG_E2ECC    0x00000001 
#define BCM_PORT_CONGESTION_CONFIG_HCFC     0x00000002 
#define BCM_PORT_CONGESTION_CONFIG_DESTMOD_FLOW_CONTROL 0x00000004 
#define BCM_PORT_CONGESTION_CONFIG_MAX_SPLIT4 0x00000008 
#define BCM_PORT_CONGESTION_CONFIG_TX       0x00000010 
#define BCM_PORT_CONGESTION_CONFIG_RX       0x00000020 
#define BCM_PORT_CONGESTION_CONFIG_SAFC     0x00000040 

/* bcm_port_congestion_config_s */
typedef struct bcm_port_congestion_config_s {
    uint32 flags;               /* congestion mode. */
    uint8 port_bits;            /* Higig format for port status */
    int packets_per_sec;        /* frequency of sending congestion messages */
    bcm_gport_t src_port;       /* gport of type mmodid:port, wildcard on
                                   receive */
    uint16 multicast_id;        /* Multicast Identifier */
    bcm_cos_t traffic_class;    /* Traffic Class */
    bcm_color_t color;          /* Color */
    bcm_vlan_t vlan;            /* Vlan */
    uint8 pri;                  /* Packet priority */
    uint8 cfi;                  /* CFI */
    bcm_mac_t src_mac;          /* Source MAC address */
    bcm_mac_t dest_mac;         /* Destination MAC address */
    uint16 ethertype;           /* Ethernet Type */
    uint16 opcode;              /* Opcode */
} bcm_port_congestion_config_t;

/* Initialize a Port Congestion Configuration structure. */
extern void bcm_port_congestion_config_t_init(
    bcm_port_congestion_config_t *config);

#ifndef BCM_HIDE_DISPATCHABLE

/* Set congestion mode. */
extern int bcm_port_congestion_config_set(
    int unit, 
    bcm_gport_t port, 
    bcm_port_congestion_config_t *config);

/* Get congestion mode. */
extern int bcm_port_congestion_config_get(
    int unit, 
    bcm_gport_t port, 
    bcm_port_congestion_config_t *config);

#endif /* BCM_HIDE_DISPATCHABLE */

/* bcm_port_phy_control_t */
typedef _shr_port_phy_control_t bcm_port_phy_control_t;

/* Controls for changing PHY settings. */
#define BCM_PORT_PHY_CONTROL_WAN            _SHR_PORT_PHY_CONTROL_WAN  
#define BCM_PORT_PHY_CONTROL_PREEMPHASIS    _SHR_PORT_PHY_CONTROL_PREEMPHASIS 
#define BCM_PORT_PHY_CONTROL_PREEMPHASIS_LANE0 _SHR_PORT_PHY_CONTROL_PREEMPHASIS_LANE0 
#define BCM_PORT_PHY_CONTROL_PREEMPHASIS_LANE1 _SHR_PORT_PHY_CONTROL_PREEMPHASIS_LANE1 
#define BCM_PORT_PHY_CONTROL_PREEMPHASIS_LANE2 _SHR_PORT_PHY_CONTROL_PREEMPHASIS_LANE2 
#define BCM_PORT_PHY_CONTROL_PREEMPHASIS_LANE3 _SHR_PORT_PHY_CONTROL_PREEMPHASIS_LANE3 
#define BCM_PORT_PHY_CONTROL_DRIVER_CURRENT _SHR_PORT_PHY_CONTROL_DRIVER_CURRENT 
#define BCM_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE0 _SHR_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE0 
#define BCM_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE1 _SHR_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE1 
#define BCM_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE2 _SHR_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE2 
#define BCM_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE3 _SHR_PORT_PHY_CONTROL_DRIVER_CURRENT_LANE3 
#define BCM_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT _SHR_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT 
#define BCM_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE0 _SHR_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE0 
#define BCM_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE1 _SHR_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE1 
#define BCM_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE2 _SHR_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE2 
#define BCM_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE3 _SHR_PORT_PHY_CONTROL_PRE_DRIVER_CURRENT_LANE3 
#define BCM_PORT_PHY_CONTROL_EQUALIZER_BOOST _SHR_PORT_PHY_CONTROL_EQUALIZER_BOOST 
#define BCM_PORT_PHY_CONTROL_INTERFACE      _SHR_PORT_PHY_CONTROL_INTERFACE 
#define BCM_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED _SHR_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED 
#define BCM_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED_SPEED _SHR_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED_SPEED 
#define BCM_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED_DUPLEX _SHR_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED_DUPLEX 
#define BCM_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED_PAUSE _SHR_PORT_PHY_CONTROL_MACSEC_SWITCH_FIXED_PAUSE 
#define BCM_PORT_PHY_CONTROL_MACSEC_PAUSE_RX_FORWARD _SHR_PORT_PHY_CONTROL_MACSEC_PAUSE_RX_FORWARD 
#define BCM_PORT_PHY_CONTROL_MACSEC_PAUSE_TX_FORWARD _SHR_PORT_PHY_CONTROL_MACSEC_PAUSE_TX_FORWARD 
#define BCM_PORT_PHY_CONTROL_MACSEC_LINE_IPG _SHR_PORT_PHY_CONTROL_MACSEC_LINE_IPG 
#define BCM_PORT_PHY_CONTROL_MACSEC_SWITCH_IPG _SHR_PORT_PHY_CONTROL_MACSEC_SWITCH_IPG 
#define BCM_PORT_PHY_CONTROL_LONGREACH_SPEED _SHR_PORT_PHY_CONTROL_LONGREACH_SPEED 
#define BCM_PORT_PHY_CONTROL_LONGREACH_PAIRS _SHR_PORT_PHY_CONTROL_LONGREACH_PAIRS 
#define BCM_PORT_PHY_CONTROL_LONGREACH_GAIN _SHR_PORT_PHY_CONTROL_LONGREACH_GAIN 
#define BCM_PORT_PHY_CONTROL_LONGREACH_AUTONEG _SHR_PORT_PHY_CONTROL_LONGREACH_AUTONEG 
#define BCM_PORT_PHY_CONTROL_LONGREACH_LOCAL_ABILITY _SHR_PORT_PHY_CONTROL_LONGREACH_LOCAL_ABILITY 
#define BCM_PORT_PHY_CONTROL_LONGREACH_REMOTE_ABILITY _SHR_PORT_PHY_CONTROL_LONGREACH_REMOTE_ABILITY 
#define BCM_PORT_PHY_CONTROL_LONGREACH_CURRENT_ABILITY _SHR_PORT_PHY_CONTROL_LONGREACH_CURRENT_ABILITY 
#define BCM_PORT_PHY_CONTROL_LONGREACH_MASTER _SHR_PORT_PHY_CONTROL_LONGREACH_MASTER 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ACTIVE _SHR_PORT_PHY_CONTROL_LONGREACH_ACTIVE 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ENABLE _SHR_PORT_PHY_CONTROL_LONGREACH_ENABLE 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_NONE _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_NONE 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_10M_1PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_10M_1PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_10M_2PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_10M_2PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_20M_1PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_20M_1PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_20M_2PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_20M_2PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_25M_1PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_25M_1PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_25M_2PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_25M_2PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_33M_1PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_33M_1PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_33M_2PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_33M_2PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_50M_1PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_50M_1PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_50M_2PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_50M_2PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_100M_1PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_100M_1PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_100M_2PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_100M_2PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_100M_4PAIR _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_100M_4PAIR 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_PAUSE_RX _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_PAUSE_RX 
#define BCM_PORT_PHY_CONTROL_LONGREACH_ABILITY_PAUSE_TX _SHR_PORT_PHY_CONTROL_LONGREACH_ABILITY_PAUSE_TX 
#define BCM_PORT_PHY_CONTROL_POWER          _SHR_PORT_PHY_CONTROL_POWER 
#define BCM_PORT_PHY_CONTROL_POWER_FULL     _SHR_PORT_PHY_CONTROL_POWER_FULL 
#define BCM_PORT_PHY_CONTROL_POWER_LOW      _SHR_PORT_PHY_CONTROL_POWER_LOW 
#define BCM_PORT_PHY_CONTROL_POWER_AUTO     _SHR_PORT_PHY_CONTROL_POWER_AUTO 
#define BCM_PORT_PHY_CONTROL_POWER_AUTO_DISABLE _SHR_PORT_PHY_CONTROL_POWER_AUTO_DISABLE 
#define BCM_PORT_PHY_CONTROL_POWER_AUTO_SLEEP_TIME _SHR_PORT_PHY_CONTROL_POWER_AUTO_SLEEP_TIME 
#define BCM_PORT_PHY_CONTROL_POWER_AUTO_WAKE_TIME _SHR_PORT_PHY_CONTROL_POWER_AUTO_WAKE_TIME 
#define BCM_PORT_PHY_CONTROL_LOOPBACK_EXTERNAL _SHR_PORT_PHY_CONTROL_LOOPBACK_EXTERNAL 
#define BCM_PORT_PHY_CONTROL_EDC_CONFIG_NONE _SHR_PORT_PHY_CONTROL_EDC_CONFIG_NONE 
#define BCM_PORT_PHY_CONTROL_EDC_CONFIG_HARDWARE _SHR_PORT_PHY_CONTROL_EDC_CONFIG_HARDWARE 
#define BCM_PORT_PHY_CONTROL_EDC_CONFIG_SOFTWARE _SHR_PORT_PHY_CONTROL_EDC_CONFIG_SOFTWARE 
#define BCM_PORT_PHY_CONTROL_EDC_MODE       _SHR_PORT_PHY_CONTROL_EDC_MODE 
#define BCM_PORT_PHY_CONTROL_CLOCK_ENABLE   _SHR_PORT_PHY_CONTROL_CLOCK_ENABLE 
#define BCM_PORT_PHY_CONTROL_CLOCK_SECONDARY_ENABLE _SHR_PORT_PHY_CONTROL_CLOCK_SECONDARY_ENABLE 
#define BCM_PORT_PHY_CONTROL_CLOCK_FREQUENCY _SHR_PORT_PHY_CONTROL_CLOCK_FREQUENCY 
#define BCM_PORT_PHY_CONTROL_PORT_PRIMARY   _SHR_PORT_PHY_CONTROL_PORT_PRIMARY 
#define BCM_PORT_PHY_CONTROL_PORT_OFFSET    _SHR_PORT_PHY_CONTROL_PORT_OFFSET 
#define BCM_PORT_PHY_CONTROL_LINKDOWN_TRANSMIT _SHR_PORT_PHY_CONTROL_LINKDOWN_TRANSMIT 
#define BCM_PORT_PHY_CONTROL_EDC_CONFIG     _SHR_PORT_PHY_CONTROL_EDC_CONFIG 
#define BCM_PORT_PHY_CONTROL_EEE            _SHR_PORT_PHY_CONTROL_EEE 
#define BCM_PORT_PHY_CONTROL_EEE_AUTO       _SHR_PORT_PHY_CONTROL_EEE_AUTO 
#define BCM_PORT_PHY_CONTROL_EEE_AUTO_IDLE_THRESHOLD _SHR_PORT_PHY_CONTROL_EEE_AUTO_IDLE_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_EEE_AUTO_BUFFER_LIMIT _SHR_PORT_PHY_CONTROL_EEE_AUTO_BUFFER_LIMIT 
#define BCM_PORT_PHY_CONTROL_EEE_AUTO_FIXED_LATENCY _SHR_PORT_PHY_CONTROL_EEE_AUTO_FIXED_LATENCY 
#define BCM_PORT_PHY_CONTROL_EEE_TRANSMIT_WAKE_TIME _SHR_PORT_PHY_CONTROL_EEE_TRANSMIT_WAKE_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_RECEIVE_WAKE_TIME _SHR_PORT_PHY_CONTROL_EEE_RECEIVE_WAKE_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_TRANSMIT_SLEEP_TIME _SHR_PORT_PHY_CONTROL_EEE_TRANSMIT_SLEEP_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_RECEIVE_SLEEP_TIME _SHR_PORT_PHY_CONTROL_EEE_RECEIVE_SLEEP_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_TRANSMIT_QUIET_TIME _SHR_PORT_PHY_CONTROL_EEE_TRANSMIT_QUIET_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_RECEIVE_QUIET_TIME _SHR_PORT_PHY_CONTROL_EEE_RECEIVE_QUIET_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_TRANSMIT_REFRESH_TIME _SHR_PORT_PHY_CONTROL_EEE_TRANSMIT_REFRESH_TIME 
#define BCM_PORT_PHY_CONTROL_EEE_TRANSMIT_EVENTS _SHR_PORT_PHY_CONTROL_EEE_TRANSMIT_EVENTS 
#define BCM_PORT_PHY_CONTROL_EEE_TRANSMIT_DURATION _SHR_PORT_PHY_CONTROL_EEE_TRANSMIT_DURATION 
#define BCM_PORT_PHY_CONTROL_EEE_RECEIVE_EVENTS _SHR_PORT_PHY_CONTROL_EEE_RECEIVE_EVENTS 
#define BCM_PORT_PHY_CONTROL_EEE_RECEIVE_DURATION _SHR_PORT_PHY_CONTROL_EEE_RECEIVE_DURATION 
#define BCM_PORT_PHY_CONTROL_EEE_STATISTICS_CLEAR _SHR_PORT_PHY_CONTROL_EEE_STATISTICS_CLEAR 
#define BCM_PORT_PHY_CONTROL_SERDES_TUNE_MARGIN_MAX _SHR_PORT_PHY_CONTROL_SERDES_TUNE_MARGIN_MAX 
#define BCM_PORT_PHY_CONTROL_SERDES_TUNE_MARGIN_MODE _SHR_PORT_PHY_CONTROL_SERDES_TUNE_MARGIN_MODE 
#define BCM_PORT_PHY_CONTROL_SERDES_TUNE_MARGIN_VALUE _SHR_PORT_PHY_CONTROL_SERDES_TUNE_MARGIN_VALUE 
#define BCM_PORT_PHY_CONTROL_PARALLEL_DETECTION _SHR_PORT_PHY_CONTROL_PARALLEL_DETECTION 
#define BCM_PORT_PHY_CONTROL_LOOPBACK_REMOTE _SHR_PORT_PHY_CONTROL_LOOPBACK_REMOTE 
#define BCM_PORT_PHY_CONTROL_FORWARD_ERROR_CORRECTION _SHR_PORT_PHY_CONTROL_FORWARD_ERROR_CORRECTION 
#define BCM_PORT_PHY_CONTROL_FEC_OFF        _SHR_PORT_PHY_CONTROL_FEC_OFF 
#define BCM_PORT_PHY_CONTROL_FEC_ON         _SHR_PORT_PHY_CONTROL_FEC_ON 
#define BCM_PORT_PHY_CONTROL_FEC_AUTO       _SHR_PORT_PHY_CONTROL_FEC_AUTO 
#define BCM_PORT_PHY_CONTROL_SCRAMBLER      _SHR_PORT_PHY_CONTROL_SCRAMBLER 
#define BCM_PORT_PHY_CONTROL_CUSTOM1        _SHR_PORT_PHY_CONTROL_CUSTOM1 
#define BCM_PORT_PHY_CONTROL_BERT_PATTERN   _SHR_PORT_PHY_CONTROL_BERT_PATTERN 
#define BCM_PORT_PHY_CONTROL_BERT_RUN       _SHR_PORT_PHY_CONTROL_BERT_RUN 
#define BCM_PORT_PHY_CONTROL_BERT_CRPAT     _SHR_PORT_PHY_CONTROL_BERT_CRPAT 
#define BCM_PORT_PHY_CONTROL_BERT_CJPAT     _SHR_PORT_PHY_CONTROL_BERT_CJPAT 
#define BCM_PORT_PHY_CONTROL_BERT_PACKET_SIZE _SHR_PORT_PHY_CONTROL_BERT_PACKET_SIZE 
#define BCM_PORT_PHY_CONTROL_BERT_IPG       _SHR_PORT_PHY_CONTROL_BERT_IPG 
#define BCM_PORT_PHY_CONTROL_BERT_TX_PACKETS _SHR_PORT_PHY_CONTROL_BERT_TX_PACKETS 
#define BCM_PORT_PHY_CONTROL_BERT_RX_PACKETS _SHR_PORT_PHY_CONTROL_BERT_RX_PACKETS 
#define BCM_PORT_PHY_CONTROL_BERT_RX_ERROR_BITS _SHR_PORT_PHY_CONTROL_BERT_RX_ERROR_BITS 
#define BCM_PORT_PHY_CONTROL_BERT_RX_ERROR_BYTES _SHR_PORT_PHY_CONTROL_BERT_RX_ERROR_BYTES 
#define BCM_PORT_PHY_CONTROL_BERT_RX_ERROR_PACKETS _SHR_PORT_PHY_CONTROL_BERT_RX_ERROR_PACKETS 
#define BCM_PORT_PHY_CONTROL_PON_LASER_TX_POWER_TIME _SHR_PORT_PHY_CONTROL_PON_LASER_TX_POWER_TIME 
#define BCM_PORT_PHY_CONTROL_PON_LASER_TX_POWER_MODE _SHR_PORT_PHY_CONTROL_PON_LASER_TX_POWER_MODE 
#define BCM_PORT_PHY_CONTROL_PON_LASER_TX_STATUS _SHR_PORT_PHY_CONTROL_PON_LASER_TX_STATUS  
#define BCM_PORT_PHY_CONTROL_PON_LASER_RX_STATE _SHR_PORT_PHY_CONTROL_PON_LASER_RX_STATE 
#define BCM_PORT_PHY_CONTROL_PON_LASER_TRANCEIVER_TEMP _SHR_PORT_PHY_CONTROL_PON_LASER_TRANCEIVER_TEMP 
#define BCM_PORT_PHY_CONTROL_PON_LASER_SUPPLY_VOLTAGE _SHR_PORT_PHY_CONTROL_PON_LASER_SUPPLY_VOLTAGE 
#define BCM_PORT_PHY_CONTROL_PON_LASER_TX_BIAS _SHR_PORT_PHY_CONTROL_PON_LASER_TX_BIAS 
#define BCM_PORT_PHY_CONTROL_PON_LASER_TX_POWER _SHR_PORT_PHY_CONTROL_PON_LASER_TX_POWER 
#define BCM_PORT_PHY_CONTROL_PON_LASER_RX_POWER _SHR_PORT_PHY_CONTROL_PON_LASER_RX_POWER 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_LOW_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_RX_POWER_LOW_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_LOW_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_LOW_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_LOW_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_LOW_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_LOW_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_TX_POWER_LOW_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_LOW_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_LOW_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_LOW_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_LOW_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_HIGH_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_VCC_HIGH_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_VCC_HIGH_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_HIGH_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_HIGH_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_HIGH_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_LOW_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_VCC_LOW_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_VCC_LOW_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_LOW_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_LOW_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_LOW_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_HIGH_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_TEMP_HIGH_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_HIGH_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_HIGH_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_HIGH_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_HIGH_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_LOW_ALARM_STATE _SHR_PORT_PHY_CONTROL_PON_TEMP_LOW_ALARM_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_LOW_ALARM_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_LOW_ALARM_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_LOW_ALARM_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_LOW_ALARM_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_HIGH_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_LOW_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_RX_POWER_LOW_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_LOW_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_LOW_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_RX_POWER_LOW_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_RX_POWER_LOW_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_HIGH_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_LOW_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_TX_POWER_LOW_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_LOW_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_LOW_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_POWER_LOW_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_POWER_LOW_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_HIGH_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TX_BIAS_LOW_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_HIGH_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_VCC_HIGH_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_VCC_HIGH_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_HIGH_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_HIGH_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_HIGH_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_LOW_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_VCC_LOW_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_VCC_LOW_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_LOW_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_VCC_LOW_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_VCC_LOW_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_HIGH_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_TEMP_HIGH_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_HIGH_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_HIGH_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_HIGH_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_HIGH_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_LOW_WARNING_STATE _SHR_PORT_PHY_CONTROL_PON_TEMP_LOW_WARNING_STATE 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_LOW_WARNING_REPORT_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_LOW_WARNING_REPORT_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_PON_TEMP_LOW_WARNING_CLEAR_THRESHOLD _SHR_PORT_PHY_CONTROL_PON_TEMP_LOW_WARNING_CLEAR_THRESHOLD 
#define BCM_PORT_PHY_CONTROL_DLL_POWER_AUTO _SHR_PORT_PHY_CONTROL_DLL_POWER_AUTO 

#ifndef BCM_HIDE_DISPATCHABLE

/* Set/Get PHY specific configurations. */
extern int bcm_port_phy_control_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_phy_control_t type, 
    uint32 value);

/* Set/Get PHY specific configurations. */
extern int bcm_port_phy_control_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_phy_control_t type, 
    uint32 *value);

/* Write the firmware to the PHY device's non-volatile storage. */
extern int bcm_port_phy_firmware_set(
    int unit, 
    bcm_port_t port, 
    uint32 flags, 
    int offset, 
    uint8 *array, 
    int length);

/* Get the GPORT ID for the specified physical port. */
extern int bcm_port_gport_get(
    int unit, 
    bcm_port_t port, 
    bcm_gport_t *gport);

/* Get the local port from the given GPORT ID. */
extern int bcm_port_local_get(
    int unit, 
    bcm_gport_t gport, 
    bcm_port_t *local_port);

/* 
 * Update the specified logical port (GPORT) with the given range(s)
 * of VIDs
 */
extern int bcm_port_vlan_vector_set(
    int unit, 
    bcm_gport_t port_id, 
    bcm_vlan_vector_t vlan_vec);

/* Get the range(s) of VIDs for the specified logical port (GPORT) */
extern int bcm_port_vlan_vector_get(
    int unit, 
    bcm_gport_t port_id, 
    bcm_vlan_vector_t vlan_vec);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Backward compatibility. */
typedef _shr_port_stp_t bcm_port_stp_t;

/* Backward compatibility. */
#define BCM_PORT_STP_DISABLE    _SHR_PORT_STP_DISABLE 
#define BCM_PORT_STP_BLOCK      _SHR_PORT_STP_BLOCK 
#define BCM_PORT_STP_LISTEN     _SHR_PORT_STP_LISTEN 
#define BCM_PORT_STP_LEARN      _SHR_PORT_STP_LEARN 
#define BCM_PORT_STP_FORWARD    _SHR_PORT_STP_FORWARD 
#define BCM_PORT_STP_COUNT      _SHR_PORT_STP_COUNT 

/* Backward compatibility. */
#define bcm_port_vlan_set(u, p, vid)  \
    bcm_port_untagged_vlan_set(u, p, vid) 

/* Backward compatibility. */
#define bcm_port_vlan_get(u, p, vdata)  \
    bcm_port_untagged_vlan_get((u), (p), &((vdata)->vlan_tag)), \
    bcm_vlan_port_get((u), (vdata)->vlan_tag, \
                      &((vdata)->port_bitmap), &((vdata)->ut_port_bitmap)) 

#ifndef BCM_HIDE_DISPATCHABLE

/* Retrieve the Policer ID accociated for the specified physical port. */
extern int bcm_port_policer_get(
    int unit, 
    bcm_port_t port, 
    bcm_policer_t *policer_id);

/* Set the Policer ID accociated for the specified physical port. */
extern int bcm_port_policer_set(
    int unit, 
    bcm_port_t port, 
    bcm_policer_t policer_id);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Types of statistics that are maintained per gport. */
typedef enum bcm_port_stat_e {
    bcmPortStatIngressPackets,  /* Packets that ingress on the gport */
    bcmPortStatIngressBytes,    /* Bytes that ingress on the gport */
    bcmPortStatEgressPackets,   /* Packets that egress on the gport */
    bcmPortStatEgressBytes      /* Bytes that egress on the gport */
} bcm_port_stat_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Enable/disable packet and byte counters for the selected gport. */
extern int bcm_port_stat_enable_set(
    int unit, 
    bcm_gport_t port, 
    int enable);

/* Get 64-bit counter value for specified port statistic type. */
extern int bcm_port_stat_get(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint64 *val);

/* Provide stat counter ids associated with given gport */
extern int bcm_port_stat_id_get(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint32 *stat_counter_id);

/* Get lower 32-bit counter value for specified port statistic type. */
extern int bcm_port_stat_get32(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint32 *val);

/* Set 64-bit counter value for specified port statistic type. */
extern int bcm_port_stat_set(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint64 val);

/* Set lower 32-bit counter value for specified port statistic type. */
extern int bcm_port_stat_set32(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint32 val);

/* Get 64-bit counter value for multiple port statistic types. */
extern int bcm_port_stat_multi_get(
    int unit, 
    bcm_gport_t port, 
    int nstat, 
    bcm_port_stat_t *stat_arr, 
    uint64 *value_arr);

/* Get lower 32-bit counter value for multiple port statistic types. */
extern int bcm_port_stat_multi_get32(
    int unit, 
    bcm_gport_t port, 
    int nstat, 
    bcm_port_stat_t *stat_arr, 
    uint32 *value_arr);

/* Set 64-bit counter value for multiple port statistic types. */
extern int bcm_port_stat_multi_set(
    int unit, 
    bcm_gport_t port, 
    int nstat, 
    bcm_port_stat_t *stat_arr, 
    uint64 *value_arr);

/* Set lower 32-bit counter value for multiple port statistic types. */
extern int bcm_port_stat_multi_set32(
    int unit, 
    bcm_gport_t port, 
    int nstat, 
    bcm_port_stat_t *stat_arr, 
    uint32 *value_arr);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Generic port match criteria */
typedef enum bcm_port_match_e {
    BCM_PORT_MATCH_INVALID,             /* Illegal */
    BCM_PORT_MATCH_NONE,                /* No matching criteria */
    BCM_PORT_MATCH_PORT,                /* Match on module/port or trunk */
    BCM_PORT_MATCH_PORT_VLAN,           /* Match on module/port or trunk + outer
                                           VLAN */
    BCM_PORT_MATCH_PORT_VLAN_RANGE,     /* Match on module/port or trunk + VLAN
                                           range */
    BCM_PORT_MATCH_PORT_VLAN_STACKED,   /* Match on module/port or trunk +
                                           inner/outer VLAN */
    BCM_PORT_MATCH_TUNNEL_VLAN_SRCMAC,  /* Match on MiM B-VLAN and source MAC */
    BCM_PORT_MATCH_LABEL,               /* Match on MPLS label */
    BCM_PORT_MATCH_LABEL_PORT,          /* Match on MPLS label + module/port or
                                           trunk */
    BCM_PORT_MATCH_LABEL_VLAN,          /* Match on MPLS label + VLAN */
    BCM_PORT_MATCH_COUNT                /* Must be last */
} bcm_port_match_t;

/* Generic port match attribute structure */
typedef struct bcm_port_match_info_s {
    bcm_port_match_t match;         /* Match criteria */
    bcm_gport_t port;               /* Match port */
    bcm_vlan_t match_vlan;          /* Outer VLAN ID to match */
    bcm_vlan_t match_vlan_max;      /* Maximum VLAN ID in range to match */
    bcm_vlan_t match_inner_vlan;    /* Inner VLAN ID to match */
    bcm_vlan_t match_tunnel_vlan;   /* B-domain VID */
    bcm_mac_t match_tunnel_srcmac;  /* B-domain source MAC address */
    bcm_mpls_label_t match_label;   /* MPLS label */
} bcm_port_match_info_t;

/* Initialize the port match structure. */
extern void bcm_port_match_info_t_init(
    bcm_port_match_info_t *port_match_info);

#ifndef BCM_HIDE_DISPATCHABLE

/* Add a match to an existing port */
extern int bcm_port_match_add(
    int unit, 
    bcm_gport_t port, 
    bcm_port_match_info_t *match);

/* Remove a match from an existing port */
extern int bcm_port_match_delete(
    int unit, 
    bcm_gport_t port, 
    bcm_port_match_info_t *match);

/* Replace an old match with a new one for an existing port */
extern int bcm_port_match_replace(
    int unit, 
    bcm_gport_t port, 
    bcm_port_match_info_t *old_match, 
    bcm_port_match_info_t *new_match);

/* Get all the matches for an existing port */
extern int bcm_port_match_multi_get(
    int unit, 
    bcm_gport_t port, 
    int size, 
    bcm_port_match_info_t *match_array, 
    int *count);

/* Assign a set of matches to an existing port */
extern int bcm_port_match_set(
    int unit, 
    bcm_gport_t port, 
    int size, 
    bcm_port_match_info_t *match_array);

/* Delete all matches for an existing port */
extern int bcm_port_match_delete_all(
    int unit, 
    bcm_gport_t port);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Timesync Configuration flags. */
#define BCM_PORT_TIMESYNC_DEFAULT           0x00000001 /* Port Timesync
                                                          configuration */
#define BCM_PORT_TIMESYNC_MPLS              0x00000002 /* Port Timesync MPLS
                                                          configuration */
#define BCM_PORT_TIMESYNC_ONE_STEP_TIMESTAMP 0x00000004 /* Port one step
                                                          timestamp
                                                          configuration */
#define BCM_PORT_TIMESYNC_TWO_STEP_TIMESTAMP 0x00000008 /* Port two step
                                                          timestamp
                                                          configuration */

/* Timesync Packet type bitmaps. */
#define BCM_PORT_TIMESYNC_PKT_SYNC          0x00000001 /* Sync Event Packet type */
#define BCM_PORT_TIMESYNC_PKT_DELAY_REQ     0x00000002 /* Delay Request Event
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_PDELAY_REQ    0x00000004 /* Pdelay Request Event
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_PDELAY_RESP   0x00000008 /* Pdelay Response Event
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_FOLLOWUP      0x00000100 /* Followup General
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_DELAY_RESP    0x00000200 /* Delay_resp General
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_PDELAY_RESP_FOLLOWUP 0x00000400 /* Pdelay_resp_followup
                                                          General Packet type */
#define BCM_PORT_TIMESYNC_PKT_ANNOUNCE      0x00000800 /* Announce General
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_SIGNALLING    0x00001000 /* Signalling General
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_MANAGMENT     0x00002000 /* Management General
                                                          Packet type */
#define BCM_PORT_TIMESYNC_PKT_INVALID       0x00004000 /* Invalid Packet type */

/* Timesync configuration. */
typedef struct bcm_port_timesync_config_s {
    uint32 flags;           /* Timesync Configuration flags */
    uint32 pkt_drop;        /* Pakcet Drop bitmap of event and general  packet
                               types */
    uint32 pkt_tocpu;       /* CPU forward bitmap of event and general  packet
                               types */
    int mpls_min_label;     /* Timesync over MPLS min label */
    int mpls_max_label;     /* Timesync over MPLS max label */
    bcm_mac_t src_mac_addr; /* Source mac address for one-step timestamp update */
} bcm_port_timesync_config_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* bcm_port_timesync_config_set */
extern int bcm_port_timesync_config_set(
    int unit, 
    bcm_port_t port, 
    int config_count, 
    bcm_port_timesync_config_t *config_array);

/* bcm_port_timesync_config_get */
extern int bcm_port_timesync_config_get(
    int unit, 
    bcm_port_t port, 
    int array_size, 
    bcm_port_timesync_config_t *config_array, 
    int *array_count);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_PHY_TIMESYNC_ETHERNET_CAPABLE _SHR_PORT_PHY_TIMESYNC_ETHERNET_CAPABLE /* PHY is 1588 over
                                                          Ethernet capable */
#define BCM_PORT_PHY_TIMESYNC_MPLS_CAPABLE  _SHR_PORT_PHY_TIMESYNC_MPLS_CAPABLE /* PHY is 1588 over MPLS
                                                          capable */
#define BCM_PORT_PHY_TIMESYNC_VALID_FLAGS   _SHR_PORT_PHY_TIMESYNC_VALID_FLAGS /* Flags field is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_ITPID   _SHR_PORT_PHY_TIMESYNC_VALID_ITPID /* itpid is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_OTPID   _SHR_PORT_PHY_TIMESYNC_VALID_OTPID /* otpid is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_OTPID2  _SHR_PORT_PHY_TIMESYNC_VALID_OTPID2 /* otpid2 is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_GMODE   _SHR_PORT_PHY_TIMESYNC_VALID_GMODE /* gmode is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_FRAMESYNC_MODE _SHR_PORT_PHY_TIMESYNC_VALID_FRAMESYNC_MODE /* framesync mode is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_SYNCOUT_MODE _SHR_PORT_PHY_TIMESYNC_VALID_SYNCOUT_MODE /* syncout mode is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_TS_DIVIDER _SHR_PORT_PHY_TIMESYNC_VALID_TS_DIVIDER /* ts divider mode is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_ORIGINAL_TIMECODE _SHR_PORT_PHY_TIMESYNC_VALID_ORIGINAL_TIMECODE /* original timecode is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_TX_TIMESTAMP_OFFSET _SHR_PORT_PHY_TIMESYNC_VALID_TX_TIMESTAMP_OFFSET /* tx timestamp offset is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_RX_TIMESTAMP_OFFSET _SHR_PORT_PHY_TIMESYNC_VALID_RX_TIMESTAMP_OFFSET /* rx timestamp offset is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_TX_SYNC_MODE _SHR_PORT_PHY_TIMESYNC_VALID_TX_SYNC_MODE /* tx sync mode is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_TX_DELAY_REQUEST_MODE _SHR_PORT_PHY_TIMESYNC_VALID_TX_DELAY_REQUEST_MODE /* tx delay request mode
                                                          is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_TX_PDELAY_REQUEST_MODE _SHR_PORT_PHY_TIMESYNC_VALID_TX_PDELAY_REQUEST_MODE /* tx pdelay request mode
                                                          is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_TX_PDELAY_RESPONSE_MODE _SHR_PORT_PHY_TIMESYNC_VALID_TX_PDELAY_RESPONSE_MODE /* tx pdelay response
                                                          mode is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_RX_SYNC_MODE _SHR_PORT_PHY_TIMESYNC_VALID_RX_SYNC_MODE /* rx sync mode is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_RX_DELAY_REQUEST_MODE _SHR_PORT_PHY_TIMESYNC_VALID_RX_DELAY_REQUEST_MODE /* rx delay request mode
                                                          is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_RX_PDELAY_REQUEST_MODE _SHR_PORT_PHY_TIMESYNC_VALID_RX_PDELAY_REQUEST_MODE /* rx pdelay request mode
                                                          is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_RX_PDELAY_RESPONSE_MODE _SHR_PORT_PHY_TIMESYNC_VALID_RX_PDELAY_RESPONSE_MODE /* rx pdelay response
                                                          mode is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_MPLS_CONTROL _SHR_PORT_PHY_TIMESYNC_VALID_MPLS_CONTROL /* mpls control is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_RX_LINK_DELAY _SHR_PORT_PHY_TIMESYNC_VALID_RX_LINK_DELAY /* rx link delay is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_K1 _SHR_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_K1 /* phy 1588 dpll k1 is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_K2 _SHR_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_K2 /* phy 1588 dpll k2 is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_K3 _SHR_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_K3 /* phy 1588 dpll k3 is
                                                          valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_LOOP_FILTER _SHR_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_LOOP_FILTER /* phy 1588 dpll loop
                                                          filter is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_REF_PHASE _SHR_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_REF_PHASE /* phy 1588 dpll ref
                                                          phase is valid */
#define BCM_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_REF_PHASE_DELTA _SHR_PORT_PHY_TIMESYNC_VALID_PHY_1588_DPLL_REF_PHASE_DELTA /* phy 1588 dpll ref
                                                          phase delta is valid */
#define BCM_PORT_PHY_TIMESYNC_ENABLE        _SHR_PORT_PHY_TIMESYNC_ENABLE /* Enable Time
                                                          Synchronization
                                                          Interface */
#define BCM_PORT_PHY_TIMESYNC_CAPTURE_TS_ENABLE _SHR_PORT_PHY_TIMESYNC_CAPTURE_TS_ENABLE /* Enable Packet
                                                          Timestamping */
#define BCM_PORT_PHY_TIMESYNC_HEARTBEAT_TS_ENABLE _SHR_PORT_PHY_TIMESYNC_HEARTBEAT_TS_ENABLE /* Enable Heartbeat
                                                          Timestamping */
#define BCM_PORT_PHY_TIMESYNC_RX_CRC_ENABLE _SHR_PORT_PHY_TIMESYNC_RX_CRC_ENABLE /* Enable CRC checking */
#define BCM_PORT_PHY_TIMESYNC_8021AS_ENABLE _SHR_PORT_PHY_TIMESYNC_8021AS_ENABLE /* Enable IEEE802.1AS
                                                          mode */
#define BCM_PORT_PHY_TIMESYNC_L2_ENABLE     _SHR_PORT_PHY_TIMESYNC_L2_ENABLE /* IEEE1588 over Layer 2 */
#define BCM_PORT_PHY_TIMESYNC_IP4_ENABLE    _SHR_PORT_PHY_TIMESYNC_IP4_ENABLE /* IEEE1588 over IPV4 UDP */
#define BCM_PORT_PHY_TIMESYNC_IP6_ENABLE    _SHR_PORT_PHY_TIMESYNC_IP6_ENABLE /* IEEE1588 over IPV6 UDP */
#define BCM_PORT_PHY_TIMESYNC_CLOCK_SRC_EXT _SHR_PORT_PHY_TIMESYNC_CLOCK_SRC_EXT /* Use external clock
                                                          source (DPLL) */
#define BCM_PORT_PHY_TIMESYNC_CLOCK_SRC_EXT_MODE _SHR_PORT_PHY_TIMESYNC_CLOCK_SRC_EXT_MODE /* DPLL mode, 0 - phase
                                                          lock, 1 - frequency
                                                          lock */
#define BCM_PORT_PHY_TIMESYNC_MPLS_LABEL_IN _SHR_PORT_PHY_TIMESYNC_MPLS_LABEL_IN /* MPLS label applies to
                                                          ingress packets */
#define BCM_PORT_PHY_TIMESYNC_MPLS_LABEL_OUT _SHR_PORT_PHY_TIMESYNC_MPLS_LABEL_OUT /* MPLS label applies to
                                                          egress packets */
#define BCM_PORT_PHY_TIMESYNC_MPLS_ENABLE   _SHR_PORT_PHY_TIMESYNC_MPLS_ENABLE /* Enable processing of
                                                          MPLS 1588 packets */
#define BCM_PORT_PHY_TIMESYNC_MPLS_ENTROPY_ENABLE _SHR_PORT_PHY_TIMESYNC_MPLS_ENTROPY_ENABLE /* Enable MPLS entropy on
                                                          1588 packets */
#define BCM_PORT_PHY_TIMESYNC_MPLS_SPECIAL_LABEL_ENABLE _SHR_PORT_PHY_TIMESYNC_MPLS_SPECIAL_LABEL_ENABLE /* Enable MPLS special
                                                          label on 1588 packets */
#define BCM_PORT_PHY_TIMESYNC_MPLS_CONTROL_WORD_ENABLE _SHR_PORT_PHY_TIMESYNC_MPLS_CONTROL_WORD_ENABLE /* Enable MPLS control
                                                          word on 1588 packets */
#define BCM_PORT_PHY_TIMESYNC_TN_LOAD       _SHR_PORT_PHY_TIMESYNC_TN_LOAD /* Load Tn upon framesync */
#define BCM_PORT_PHY_TIMESYNC_TN_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_TN_ALWAYS_LOAD /* Always load Tn upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_TIMECODE_LOAD _SHR_PORT_PHY_TIMESYNC_TIMECODE_LOAD /* Load timecode upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_TIMECODE_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_TIMECODE_ALWAYS_LOAD /* Always load timecode
                                                          upon framesync */
#define BCM_PORT_PHY_TIMESYNC_SYNCOUT_LOAD  _SHR_PORT_PHY_TIMESYNC_SYNCOUT_LOAD /* Load syncout upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_SYNCOUT_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_SYNCOUT_ALWAYS_LOAD /* Always load syncout
                                                          upon framesync */
#define BCM_PORT_PHY_TIMESYNC_NCO_DIVIDER_LOAD _SHR_PORT_PHY_TIMESYNC_NCO_DIVIDER_LOAD /* Load NCO divider upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_NCO_DIVIDER_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_NCO_DIVIDER_ALWAYS_LOAD /* Always load NCO
                                                          divider upon framesync */
#define BCM_PORT_PHY_TIMESYNC_LOCAL_TIME_LOAD _SHR_PORT_PHY_TIMESYNC_LOCAL_TIME_LOAD /* Load local time upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_LOCAL_TIME_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_LOCAL_TIME_ALWAYS_LOAD /* Always load local time
                                                          upon framesync */
#define BCM_PORT_PHY_TIMESYNC_NCO_ADDEND_LOAD _SHR_PORT_PHY_TIMESYNC_NCO_ADDEND_LOAD /* Load NCO addend upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_NCO_ADDEND_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_NCO_ADDEND_ALWAYS_LOAD /* Always load NCO addend
                                                          upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_LOOP_FILTER_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_LOOP_FILTER_LOAD /* Load DPLL loop filter
                                                          upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_LOOP_FILTER_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_LOOP_FILTER_ALWAYS_LOAD /* Always load DPLL loop
                                                          filter upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_LOAD /* Load DPLL ref phase
                                                          upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_ALWAYS_LOAD /* Always load DPLL ref
                                                          phase upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_DELTA_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_DELTA_LOAD /* Load DPLL ref phase
                                                          delta upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_DELTA_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_REF_PHASE_DELTA_ALWAYS_LOAD /* Always load DPLL ref
                                                          phase delta upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_K3_LOAD  _SHR_PORT_PHY_TIMESYNC_DPLL_K3_LOAD /* Load DPLL coefficient
                                                          K3 upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_K3_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_K3_ALWAYS_LOAD /* Always load DPLL
                                                          coefficient K3 upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_K2_LOAD  _SHR_PORT_PHY_TIMESYNC_DPLL_K2_LOAD /* Load DPLL coefficient
                                                          K2 upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_K2_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_K2_ALWAYS_LOAD /* Always load DPLL
                                                          coefficient K2 upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_K1_LOAD  _SHR_PORT_PHY_TIMESYNC_DPLL_K1_LOAD /* Load DPLL coefficient
                                                          K1 upon framesync */
#define BCM_PORT_PHY_TIMESYNC_DPLL_K1_ALWAYS_LOAD _SHR_PORT_PHY_TIMESYNC_DPLL_K1_ALWAYS_LOAD /* Always load DPLL
                                                          coefficient K1 upon
                                                          framesync */
#define BCM_PORT_PHY_TIMESYNC_TIMESTAMP_INTERRUPT _SHR_PORT_PHY_TIMESYNC_TIMESTAMP_INTERRUPT /* Packet timestamp
                                                          interrupt */
#define BCM_PORT_PHY_TIMESYNC_FRAMESYNC_INTERRUPT _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_INTERRUPT /* Framesync interrupt */
#define BCM_PORT_PHY_TIMESYNC_TIMESTAMP_INTERRUPT_MASK _SHR_PORT_PHY_TIMESYNC_TIMESTAMP_INTERRUPT_MASK /* Packet timestamp
                                                          interrupt mask */
#define BCM_PORT_PHY_TIMESYNC_FRAMESYNC_INTERRUPT_MASK _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_INTERRUPT_MASK /* Framesync interrupt
                                                          mask */

/* Actions on Egress event messages */
typedef enum bcm_port_phy_timesync_event_message_egress_mode_e {
    bcmPortPhyTimesyncEventMessageEgressModeNone = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_EGRESS_MODE_NONE, /* Do nothing */
    bcmPortPhyTimesyncEventMessageEgressModeUpdateCorrectionField = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_EGRESS_MODE_UPDATE_CORRECTIONFIELD, /* Update correction field */
    bcmPortPhyTimesyncEventMessageEgressModeReplaceCorrectionFieldOrigin = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_EGRESS_MODE_REPLACE_CORRECTIONFIELD_ORIGIN, /* Replace correction field + original
                                           timecode */
    bcmPortPhyTimesyncEventMessageEgressModeCaptureTimestamp = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_EGRESS_MODE_CAPTURE_TIMESTAMP /* Capture TX timestamp */
} bcm_port_phy_timesync_event_message_egress_mode_t;

/* Actions on ingress event messages */
typedef enum bcm_port_phy_timesync_event_message_ingress_mode_e {
    bcmPortPhyTimesyncEventMessageIngressModeNone = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_INGRESS_MODE_NONE, /* Do nothing */
    bcmPortPhyTimesyncEventMessageIngressModeUpdateCorrectionField = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_INGRESS_MODE_UPDATE_CORRECTIONFIELD, /* Update correction field */
    bcmPortPhyTimesyncEventMessageIngressModeInsertTimestamp = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_INGRESS_MODE_INSERT_TIMESTAMP, /* Insert timestamp */
    bcmPortPhyTimesyncEventMessageIngressModeInsertDelaytime = _SHR_PORT_PHY_TIMESYNC_EVENT_MESSAGE_INGRESS_MODE_INSERT_DELAYTIME /* Insert delay */
} bcm_port_phy_timesync_event_message_ingress_mode_t;

/* Global mode actions */
typedef enum bcm_port_phy_timesync_global_mode_e {
    bcmPortPhyTimesyncModeFree = _SHR_PORT_PHY_TIMESYNC_MODE_FREE, /* Do nothing */
    bcmPortPhyTimesyncModeSyncin = _SHR_PORT_PHY_TIMESYNC_MODE_SYNCIN, /* Use syncin as the source */
    bcmPortPhyTimesyncModeCpu = _SHR_PORT_PHY_TIMESYNC_MODE_CPU /* CPU based framesync */
} bcm_port_phy_timesync_global_mode_t;

/* Fast call actions */
typedef enum bcm_port_control_phy_timesync_e {
    bcmPortControlPhyTimesyncCaptureTimestamp = _SHR_PORT_CONTROL_PHY_TIMESYNC_CAPTURE_TIMESTAMP, /* Captured TS from packets */
    bcmPortControlPhyTimesyncHeartbeatTimestamp = _SHR_PORT_CONTROL_PHY_TIMESYNC_HEARTBEAT_TIMESTAMP, /* Heartbeat TS at framesync */
    bcmPortControlPhyTimesyncNCOAddend = _SHR_PORT_CONTROL_PHY_TIMESYNC_NCOADDEND, /* NCO addend (for non DPLL mode) */
    bcmPortControlPhyTimesyncFrameSync = _SHR_PORT_CONTROL_PHY_TIMESYNC_FRAMESYNC, /* Cause immediate framesync */
    bcmPortControlPhyTimesyncLocalTime = _SHR_PORT_CONTROL_PHY_TIMESYNC_LOCAL_TIME, /* Set local time (44 bits) */
    bcmPortControlPhyTimesyncLoadControl = _SHR_PORT_CONTROL_PHY_TIMESYNC_LOAD_CONTROL, /* Load control and sticky bits */
    bcmPortControlPhyTimesyncInterrupt = _SHR_PORT_CONTROL_PHY_TIMESYNC_INTERRUPT, /* 1588 PHY interrupt status */
    bcmPortControlPhyTimesyncInterruptMask = _SHR_PORT_CONTROL_PHY_TIMESYNC_INTERRUPT_MASK, /* 1588 PHY interrupt mask */
    bcmPortControlPhyTimesyncTxTimestampOffset = _SHR_PORT_CONTROL_PHY_TIMESYNC_TX_TIMESTAMP_OFFSET, /* TX AFE delay */
    bcmPortControlPhyTimesyncRxTimestampOffset = _SHR_PORT_CONTROL_PHY_TIMESYNC_RX_TIMESTAMP_OFFSET /* RX AFE delay */
} bcm_port_control_phy_timesync_t;

/* framesync mode */
typedef enum bcm_port_phy_timesync_framesync_mode_e {
    bcmPortPhyTimesyncFramesyncNone = _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_NONE, /* Do nothing */
    bcmPortPhyTimesyncFramesyncSyncin0 = _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_SYNCIN0, /* Use syncin as the source */
    bcmPortPhyTimesyncFramesyncSyncin1 = _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_SYNCIN1, /* CPU based framesync */
    bcmPortPhyTimesyncFramesyncSyncout = _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_SYNCOUT, /* CPU based framesync */
    bcmPortPhyTimesyncFramesyncCpu = _SHR_PORT_PHY_TIMESYNC_FRAMESYNC_CPU /* CPU based framesync */
} bcm_port_phy_timesync_framesync_mode_t;

/* framesync configuration type. */
typedef struct bcm_port_phy_timesync_framesync_s {
    bcm_port_phy_timesync_framesync_mode_t mode; /* framesync mode */
    uint32 length_threshold;            /* syncin threshold for framesync */
    uint32 event_offset;                /* event offset for framesync */
} bcm_port_phy_timesync_framesync_t;

/* syncout mode */
typedef enum bcm_port_phy_timesync_syncout_mode_e {
    bcmPortPhyTimesyncSyncoutDisable = _SHR_PORT_PHY_TIMESYNC_SYNCOUT_DISABLE, /* Do nothing */
    bcmPortPhyTimesyncSyncoutOneTime = _SHR_PORT_PHY_TIMESYNC_SYNCOUT_ONE_TIME, /* Use syncin as the source */
    bcmPortPhyTimesyncSyncoutPulseTrain = _SHR_PORT_PHY_TIMESYNC_SYNCOUT_PULSE_TRAIN, /* CPU based framesync */
    bcmPortPhyTimesyncSyncoutPulseTrainWithSync = _SHR_PORT_PHY_TIMESYNC_SYNCOUT_PULSE_TRAIN_WITH_SYNC /* CPU based framesync */
} bcm_port_phy_timesync_syncout_mode_t;

/* syncout configuration type. */
typedef struct bcm_port_phy_timesync_syncout_s {
    bcm_port_phy_timesync_syncout_mode_t mode; /* syncout mode */
    uint16 pulse_1_length;              /* pulse 1 length in ns */
    uint16 pulse_2_length;              /* pulse 2 length in ns */
    uint32 interval;                    /* interval in ns */
    uint64 syncout_ts;                  /* syncout timestamp */
} bcm_port_phy_timesync_syncout_t;

/* MPLS label type. */
typedef struct bcm_port_phy_timesync_mpls_label_s {
    bcm_mpls_label_t value; /* label value */
    bcm_mpls_label_t mask;  /* label mask */
    uint32 flags;           /* MPLS label flags */
} bcm_port_phy_timesync_mpls_label_t;

/* MPLS control type. */
typedef struct bcm_port_phy_timesync_mpls_control_s {
    uint32 flags;                       /* MPLS control flags */
    bcm_mpls_label_t special_label;     /* special label value */
    bcm_port_phy_timesync_mpls_label_t *labels; /* Timesync MPLS labels */
    int size;                           /* Number of elements in label array */
} bcm_port_phy_timesync_mpls_control_t;

/* Base timesync configuration type. */
typedef struct bcm_port_phy_timesync_config_s {
    uint32 validity_mask;               /* Flags BCM_PORT_PHY_TIMESYNC_VALID_* */
    uint32 flags;                       /* Flags BCM_PORT_PHY_TIMESYNC_* */
    uint16 itpid;                       /* 1588 inner tag */
    uint16 otpid;                       /* 1588 outer tag */
    uint16 otpid2;                      /* 1588 outer tag2 */
    bcm_port_phy_timesync_global_mode_t gmode; /* Global mode */
    bcm_port_phy_timesync_framesync_t framesync; /* Framesync */
    bcm_port_phy_timesync_syncout_t syncout; /* Syncout */
    uint16 ts_divider;                  /* TS divider */
    bcm_time_spec_t original_timecode;  /* Original timecode to be inserted */
    uint32 tx_timestamp_offset;         /* TX AFE delay in ns - per port */
    uint32 rx_timestamp_offset;         /* RX AFE delay in ns - per port */
    uint32 rx_link_delay;               /* RX link delay */
    bcm_port_phy_timesync_event_message_egress_mode_t tx_sync_mode; /* sync */
    bcm_port_phy_timesync_event_message_egress_mode_t tx_delay_request_mode; /* delay request */
    bcm_port_phy_timesync_event_message_egress_mode_t tx_pdelay_request_mode; /* pdelay request */
    bcm_port_phy_timesync_event_message_egress_mode_t tx_pdelay_response_mode; /* pdelay response */
    bcm_port_phy_timesync_event_message_ingress_mode_t rx_sync_mode; /* sync */
    bcm_port_phy_timesync_event_message_ingress_mode_t rx_delay_request_mode; /* delay request */
    bcm_port_phy_timesync_event_message_ingress_mode_t rx_pdelay_request_mode; /* pdelay request */
    bcm_port_phy_timesync_event_message_ingress_mode_t rx_pdelay_response_mode; /* pdelay response */
    bcm_port_phy_timesync_mpls_control_t mpls_control; /* MPLS control */
    uint16 phy_1588_dpll_k1;            /* DPLL K1 */
    uint16 phy_1588_dpll_k2;            /* DPLL K2 */
    uint16 phy_1588_dpll_k3;            /* DPLL K3 */
    uint64 phy_1588_dpll_loop_filter;   /* DPLL loop filter */
    uint64 phy_1588_dpll_ref_phase;     /* DPLL ref phase */
    uint32 phy_1588_dpll_ref_phase_delta; /* DPLL ref phase delta */
} bcm_port_phy_timesync_config_t;

/* bcm_port_phy_timesync_config_t_init */
extern void bcm_port_phy_timesync_config_t_init(
    bcm_port_phy_timesync_config_t *conf);

#ifndef BCM_HIDE_DISPATCHABLE

/* bcm_port_phy_timesync_config_set */
extern int bcm_port_phy_timesync_config_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_phy_timesync_config_t *conf);

/* bcm_port_phy_timesync_config_get */
extern int bcm_port_phy_timesync_config_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_phy_timesync_config_t *conf);

/* bcm_port_control_phy_timesync_set */
extern int bcm_port_control_phy_timesync_set(
    int unit, 
    bcm_port_t port, 
    bcm_port_control_phy_timesync_t type, 
    uint64 value);

/* bcm_port_control_phy_timesync_get */
extern int bcm_port_control_phy_timesync_get(
    int unit, 
    bcm_port_t port, 
    bcm_port_control_phy_timesync_t type, 
    uint64 *value);

#endif /* BCM_HIDE_DISPATCHABLE */

#define BCM_PORT_CONGESTION_MAPPING_CLEAR   _SHR_PORT_CONGESTION_MAPPING_CLEAR /* Clear mapping */
#define BCM_PORT_CONGESTION_MAPPING_RX      _SHR_PORT_CONGESTION_MAPPING_RX /* Mapping for Rx
                                                          Direction */
#define BCM_PORT_CONGESTION_MAPPING_TX      _SHR_PORT_CONGESTION_MAPPING_TX /* Mapping for Tx
                                                          Direction */

#define BCM_PORT_CHANNEL_ID_SET(_channel_id, _port_base, _port_ch)  \
    _SHR_PORT_CHANNEL_ID_SET(_channel_id, _port_base, _port_ch) 

#define BCM_PORT_CHANNEL_ID_PORT_BASE_GET(_channel_id)  \
    _SHR_PORT_CHANNEL_ID_PORT_BASE_GET(_channel_id) 

#define BCM_PORT_CHANNEL_ID_PORT_CH_GET(_channel_id)  \
    _SHR_PORT_CHANNEL_ID_PORT_CH_GET(_channel_id) 

#ifndef BCM_HIDE_DISPATCHABLE

/* Set mapping for port to  HCFC port(channel_id) */
extern int bcm_port_congestion_set(
    int unit, 
    bcm_gport_t congestion_port, 
    bcm_gport_t port, 
    uint32 flags, 
    int channel_id);

/* retreive mapping for port to  HCFC port(channel_id) */
extern int bcm_port_congestion_get(
    int unit, 
    bcm_gport_t congestion_port, 
    bcm_gport_t port, 
    uint32 flags, 
    int *channel_id);

#endif /* BCM_HIDE_DISPATCHABLE */

#if defined(INCLUDE_CES)
/* TDM Port Flags. */
#define BCM_TDM_PORT_CAS_STATUS_INGRESS 0x00000001 
#define BCM_TDM_PORT_CAS_STATUS_EGRESS  0x00000002 
#endif

#if defined(INCLUDE_CES)
/* TDM Port structure. */
typedef struct bcm_tdm_port_config_s {
    int e_protocol;                 /* E1/T1 circuit selection. */
    int b_structured;               /* Enable/Disbale structured or
                                       unstructured. */
    int b_octet_aligned;            /* Enable/Disable octet aligned mode. */
    int b_signaling_enable;         /* Enable/Disable CAS signaling. */
    int b_T1_D4_framing;            /* Enable/Disable T1 D4 framing. */
    uint32 e_clk_rx_select;         /* Select receive clock source */
    uint32 e_clk_tx_select;         /* Select transmit clock source. */
    uint32 n_cas_idle_timeslots;    /* CAS idle timeslot bit mask. */
    uint32 n_step_size;             /* Step size for BRG. */
    int b_txcrc;                    /* Enable/Disable Tx CRC. */
    int b_rxcrc;                    /* Enable/Disable Rx CRC. */
    int b_master;                   /* Enable/Disable Master. */
    uint32 n_signaling_format;      /* Signaling format, 0 = Clear Channel, 2 =
                                       T1 Four state, 3 = T1 16 state (ESF only) */
} bcm_tdm_port_config_t;
#endif

#if defined(INCLUDE_CES)
/* bcm_port_ability_t_init */
extern void bcm_port_tdm_config_t_init(
    bcm_tdm_port_config_t *config);
#endif

#ifndef BCM_HIDE_DISPATCHABLE

#if defined(INCLUDE_CES)
/* Set TDM port attributes. */
extern int bcm_port_tdm_config_set(
    int unit, 
    bcm_port_t tdm_port, 
    bcm_tdm_port_config_t *config);
#endif

#if defined(INCLUDE_CES)
/* Get TDM port attributes. */
extern int bcm_port_tdm_config_get(
    int unit, 
    bcm_port_t tdm_port, 
    bcm_tdm_port_config_t *config);
#endif

#if defined(INCLUDE_CES)
/* Get TDM port CAS change bits. */
extern int bcm_port_tdm_cas_status_get(
    int unit, 
    bcm_port_t tdm_port, 
    uint32 *cas_changed);
#endif

#if defined(INCLUDE_CES)
/* Get TDM port CAS ABCD bits. */
extern int bcm_port_tdm_cas_abcd_get(
    int unit, 
    bcm_port_t tdm_port, 
    bcm_tdm_port_cas_status_t status, 
    uint8 *cas_abcd);
#endif

#if defined(INCLUDE_CES)
/* Get associated CES ports. */
extern int bcm_port_tdm_ces_ports_get(
    int unit, 
    bcm_port_t tdm_port, 
    uint32 *n_ports, 
    uint32 ces_ports[BCM_CES_SLOT_MAX]);
#endif

/* Attach  counter entries to the given gport */
extern int bcm_port_stat_attach(
    int unit, 
    bcm_gport_t port, 
    uint32 stat_counter_id);

/* Detach counter entries to the given gport */
extern int bcm_port_stat_detach(
    int unit, 
    bcm_gport_t port);

/* Get   counter values for specified gport based on port statistic type */
extern int bcm_port_stat_counter_get(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint32 num_entries, 
    uint32 *counter_indexes, 
    bcm_stat_value_t *counter_values);

/* Set   counter values for specified gport based on port statistic type */
extern int bcm_port_stat_counter_set(
    int unit, 
    bcm_gport_t port, 
    bcm_port_stat_t stat, 
    uint32 num_entries, 
    uint32 *counter_indexes, 
    bcm_stat_value_t *counter_values);

#endif /* BCM_HIDE_DISPATCHABLE */

#endif /* __BCM_PORT_H__ */
